kushi-agents 5.6.4 → 5.7.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 (48) hide show
  1. package/package.json +1 -1
  2. package/plugin/instructions/bootstrap-status-format.instructions.md +151 -151
  3. package/plugin/instructions/customer-hint-discovery.instructions.md +131 -131
  4. package/plugin/instructions/deferred-retry-on-workiq-fail.instructions.md +155 -155
  5. package/plugin/instructions/evidence-layout-canonical.instructions.md +123 -123
  6. package/plugin/instructions/karpathy-state-layout.instructions.md +124 -124
  7. package/plugin/instructions/living-wiki.instructions.md +88 -88
  8. package/plugin/instructions/log-format.instructions.md +78 -78
  9. package/plugin/instructions/no-hallucinated-success.instructions.md +45 -0
  10. package/plugin/instructions/onedrive-pin-policy.instructions.md +132 -132
  11. package/plugin/instructions/tracking.instructions.md +165 -165
  12. package/plugin/instructions/weekly-csc.instructions.md +335 -335
  13. package/plugin/learnings/crm.md +96 -96
  14. package/plugin/learnings/cross-cutting.md +127 -76
  15. package/plugin/learnings/meetings.md +30 -30
  16. package/plugin/learnings/onenote.md +200 -200
  17. package/plugin/plugin.json +1 -0
  18. package/plugin/reference-packs/fde/report-doctrine.md +189 -189
  19. package/plugin/runners/discover.mjs +286 -0
  20. package/plugin/runners/package.json +11 -11
  21. package/plugin/runners/test/unit/discover.test.mjs +130 -0
  22. package/plugin/skills/apply-ado-update/SKILL.md +135 -135
  23. package/plugin/skills/ask-project/evals/evals.json +34 -34
  24. package/plugin/skills/bootstrap-project/SKILL.md +4 -2
  25. package/plugin/skills/consolidate-evidence/SKILL.md +10 -10
  26. package/plugin/skills/discover-project/SKILL.md +56 -0
  27. package/plugin/skills/discover-project/evals/evals.json +46 -0
  28. package/plugin/skills/pull-onenote/write-snapshot.mjs +272 -272
  29. package/plugin/skills/refresh-project/SKILL.md +1 -0
  30. package/plugin/skills/setup/references/onedrive-pin-sync.md +60 -60
  31. package/plugin/templates/init/external-links.template.txt +30 -30
  32. package/plugin/templates/snapshot/meeting-verbatim.template.md +104 -104
  33. package/plugin/templates/state/00_overview.template.md +44 -44
  34. package/plugin/templates/state/01_decisions.template.md +41 -41
  35. package/plugin/templates/state/02_stakeholders.template.md +48 -48
  36. package/plugin/templates/state/03_architecture-and-solution.template.md +56 -56
  37. package/plugin/templates/state/04_workshops-and-key-meetings.template.md +43 -43
  38. package/plugin/templates/state/05_action-items.template.md +29 -29
  39. package/plugin/templates/state/06_risks-and-issues.template.md +43 -43
  40. package/plugin/templates/state/07_timeline-and-milestones.template.md +45 -45
  41. package/plugin/templates/state/08_artifacts-and-deliverables.template.md +55 -55
  42. package/plugin/templates/state/09_open-questions.template.md +62 -62
  43. package/plugin/templates/weekly/run-log.template.md +88 -88
  44. package/src/bootstrap-dryrun.integration.test.mjs +235 -235
  45. package/src/detect-vertex-repo.test.mjs +128 -128
  46. package/src/emit-vertex.e2e.test.mjs +308 -308
  47. package/src/install-runner-deps.mjs +57 -57
  48. package/src/vertex-validate.test.mjs +142 -142
@@ -1,155 +1,155 @@
1
- ---
2
- applyTo: "**"
3
- description: "When WorkIQ fails (and the doubled-strict retry also fails), Kushi MUST NOT fall back to Graph / m365_get_* / Dataverse REST as a workaround. Instead, write a deferred-retry marker, surface it in the run report, and continue. The next refresh drains the queue. This is the v4.4.1 hard rule that closes the last Graph-fallback escape hatch."
4
- ---
5
-
6
- # Deferred-Retry on WorkIQ Failure (HARD RULE, kushi v4.4.1+)
7
-
8
- ## Why this exists
9
-
10
- `workiq-only.instructions.md` (v3.11.0+) forbade Graph / `m365_get_*` as a **first-class fallback**. But the doctrine's step 3 still said *"ask the user to paste"* — which in practice agents interpreted as:
11
-
12
- 1. *"WorkIQ failed → block the entire run and wait for the human."* (bootstrap stops mid-flight, evidence for OTHER sources is lost)
13
- 2. *"WorkIQ failed → silently try `m365_get_*` since it's right there in the tool list."* (the very anti-pattern workiq-only was meant to kill)
14
- 3. *"WorkIQ failed → skip the source, no record."* (next refresh never retries; the gap is permanent)
15
-
16
- All three are defects. This rule replaces them with a deterministic, auditable, **non-blocking** flow.
17
-
18
- ## The rule (HARD)
19
-
20
- When a WorkIQ call fails (auth error, empty after doubled-strict retry, throttled, CLI error, or any non-success), Kushi MUST:
21
-
22
- 1. **NOT call Graph, `m365_get_*`, or any other M365 host tool as a fallback.** No exceptions. Even if the tool is right there and looks like it would work. The doctrine in `workiq-only.instructions.md` is absolute.
23
- 2. **Write a deferred-retry marker** (see schema below).
24
- 3. **Surface a one-liner** in coverage.md, the per-user run report, and the project's `bootstrap-status.md` `## Deferred Retries` section.
25
- 4. **Continue the run** for all other sources. Never block the orchestrator on a single source's failure.
26
- 5. **Inform the user** at end-of-run with the count of deferred items and the path to the queue directory.
27
-
28
- The next `refresh-project` run drains the queue first (Step 2a). On success, the marker is deleted. On repeated failure, the marker's `attempts` counter increments and the user is re-informed.
29
-
30
- ## Marker file location
31
-
32
- ```
33
- <engagement-root>/<project>/Evidence/<alias>/_deferred-retries/<YYYY-MM-DD-HHmm>_<source>_<short-reason>.yml
34
- ```
35
-
36
- - Per-contributor (`<alias>`) — never shared, so multi-user safety is moot.
37
- - Sortable by filename (chronological).
38
- - One marker per failed call. Do NOT batch — granular markers make retry deterministic.
39
-
40
- ## Marker schema
41
-
42
- ```yaml
43
- # Deferred-retry marker — auto-generated. Do NOT hand-edit.
44
- # Drained by refresh-project Step 2a. Deleted on retry success.
45
- schema_version: 1
46
- source: meetings # one of: email, teams, meetings, onenote, sharepoint, crm, ado, misc, identity
47
- project: Northwind
48
- alias: ushak
49
- created_at: 2026-05-20T12:30:00Z
50
- attempts: 1
51
- last_attempt_at: 2026-05-20T12:30:00Z
52
- window: { from: '2026-04-20', to: '2026-05-20' }
53
- target:
54
- # source-specific identifying fields — exactly what the retry needs to re-issue the call
55
- subject: "JD FDE Intake"
56
- date: "2026-05-13"
57
- workiq:
58
- command: 'workiq ask -q "Find the Teams meeting titled \"JD FDE Intake\" that occurred on 2026-05-13..."'
59
- request_id: '54d9c6bc-6e56-43b6-9eb7-ac23e86e2cc0' # if WorkIQ returned one before failing
60
- error_class: 'empty-after-doubled-strict' # auth-error | empty | empty-after-doubled-strict | throttled | cli-error | timeout
61
- error_message: 'WorkIQ returned a summary only after both prompts.'
62
- user_message: |
63
- Could not retrieve the full verbatim transcript of "JD FDE Intake" (2026-05-13) via WorkIQ.
64
- The next refresh will retry automatically. To populate now, paste the transcript into
65
- Evidence/ushak/meetings/snapshot/2026-05-13_jd-fde-intake_transcript.md and mark this marker
66
- resolved by deleting the file.
67
- ```
68
-
69
- ## Producer contract (every pull-* skill + identity-resolution)
70
-
71
- Before considering a source "failed and skipped", the skill MUST:
72
-
73
- 1. Call WorkIQ once with the canonical prompt from `workiq-only.instructions.md`.
74
- 2. On weak result, call the doubled-strict retry prompt from the same table.
75
- 3. If both fail:
76
- - Write the marker per the schema above.
77
- - Add a row to coverage.md: `Source: WorkIQ → DEFERRED (marker: <relative-path>)`.
78
- - Continue the run. Do NOT throw. Do NOT call any other M365 tool.
79
-
80
- Pseudocode (PowerShell shape):
81
-
82
- ```powershell
83
- $result = Invoke-WorkIQ -Query $canonical
84
- if (-not (Test-Sufficient $result)) {
85
- $result = Invoke-WorkIQ -Query $doubledStrict
86
- }
87
- if (-not (Test-Sufficient $result)) {
88
- Write-DeferredRetryMarker -Source $src -Target $target -Window $win -Workiq $workiqMeta
89
- Add-CoverageRow -Source 'WorkIQ' -Status 'DEFERRED' -MarkerPath $markerPath
90
- return # CONTINUE the orchestrator with the next source. NEVER call m365_get_*.
91
- }
92
- ```
93
-
94
- ## Consumer contract (refresh-project)
95
-
96
- `refresh-project` SKILL Step 2a (NEW, REQUIRED) runs **before** the per-source dispatch loop:
97
-
98
- ```
99
- For each <alias>/_deferred-retries/*.yml in chronological order:
100
- - Load marker
101
- - Re-issue the canonical WorkIQ query with original window + target
102
- - If success → write artifact to its canonical Evidence/ path, delete marker, log "drained" in refresh report
103
- - If failure → increment attempts, update last_attempt_at, leave marker in place, log "still-deferred"
104
- After drain → run normal Step 2 per-source dispatch
105
- After Step 2 → report drain results in the run report's `## Deferred-retry drain` section
106
- ```
107
-
108
- If `attempts` reaches 5, do NOT keep silently retrying. Promote to a project-level Open Question:
109
-
110
- ```
111
- - [ ] DEFERRED-RETRY (5 attempts): <source> for <target>. See <marker-path>. Manual intervention required (paste verbatim, or remove the marker if no longer needed).
112
- ```
113
-
114
- ## bootstrap-status.md integration
115
-
116
- `bootstrap-status-format.instructions.md` mandates a `## Deferred Retries` section. Format:
117
-
118
- ```
119
- ## Deferred Retries
120
-
121
- | Source | Target | Attempts | Marker | First seen |
122
- |---|---|---|---|---|
123
- | meetings | JD FDE Intake 2026-05-13 | 1 | Evidence/ushak/_deferred-retries/2026-05-20-1230_meetings_empty.yml | 2026-05-20 |
124
- ```
125
-
126
- Section is omitted entirely when no markers exist.
127
-
128
- ## What "informing the user" looks like
129
-
130
- At end-of-run summary (every `pull-*`, `bootstrap-project`, `refresh-project`):
131
-
132
- ```
133
- ⚠ Deferred retries this run: 2 (will retry on next `refresh <project>`)
134
- - meetings/JD FDE Intake 2026-05-13 → Evidence/ushak/_deferred-retries/2026-05-20-1230_meetings_empty.yml
135
- - onenote/Architecture overview → Evidence/ushak/_deferred-retries/2026-05-20-1231_onenote_throttled.yml
136
- ```
137
-
138
- Never silent. Never collapsed. The user sees exactly which calls deferred and where to find the markers.
139
-
140
- ## Anti-patterns (defects)
141
-
142
- 1. **Calling `m365_get_*` / Graph REST after a WorkIQ failure.** FORBIDDEN. Even "just to check if it works." Even "as a last resort." Write the marker; move on.
143
- 2. **Throwing / blocking the orchestrator on a single source's WorkIQ failure.** FORBIDDEN. Bootstrap and refresh dispatch every enabled source; a single failure must not stop the others.
144
- 3. **Silently skipping a source with no marker.** FORBIDDEN. If WorkIQ failed and you did NOT write a marker, the user has no signal and `refresh` will never retry. Always mark.
145
- 4. **Asking the user to paste mid-run as the primary recovery.** Pasting is a manual override the user MAY do later (by populating the artifact directly and deleting the marker). It is NOT the agent's recovery flow. The agent's recovery flow is: mark + continue + inform.
146
- 5. **Promoting markers to OPEN-QUESTIONS-DRAFT.md before 5 attempts.** Too noisy. Let refresh drain naturally.
147
- 6. **Storing markers outside `Evidence/<alias>/_deferred-retries/`.** Wrong location = the drainer can't find them. Wrong scope = breaks multi-user (markers are per-contributor by design).
148
-
149
- ## Cross-references
150
-
151
- - `workiq-only.instructions.md` — WorkIQ is the only path. This file defines what happens when that path fails.
152
- - `identity-resolution.instructions.md` — "Failure modes" table now cites this rule.
153
- - `bootstrap-status-format.instructions.md` — `## Deferred Retries` section contract.
154
- - `multi-user-shared-files.instructions.md` — `_deferred-retries/` is per-contributor (under `Evidence/<alias>/`) so multi-user collision doctrine does not apply.
155
- - `verbatim-by-default.instructions.md` — deferring is NOT a silent skip. A marker IS the audit trail.
1
+ ---
2
+ applyTo: "**"
3
+ description: "When WorkIQ fails (and the doubled-strict retry also fails), Kushi MUST NOT fall back to Graph / m365_get_* / Dataverse REST as a workaround. Instead, write a deferred-retry marker, surface it in the run report, and continue. The next refresh drains the queue. This is the v4.4.1 hard rule that closes the last Graph-fallback escape hatch."
4
+ ---
5
+
6
+ # Deferred-Retry on WorkIQ Failure (HARD RULE, kushi v4.4.1+)
7
+
8
+ ## Why this exists
9
+
10
+ `workiq-only.instructions.md` (v3.11.0+) forbade Graph / `m365_get_*` as a **first-class fallback**. But the doctrine's step 3 still said *"ask the user to paste"* — which in practice agents interpreted as:
11
+
12
+ 1. *"WorkIQ failed → block the entire run and wait for the human."* (bootstrap stops mid-flight, evidence for OTHER sources is lost)
13
+ 2. *"WorkIQ failed → silently try `m365_get_*` since it's right there in the tool list."* (the very anti-pattern workiq-only was meant to kill)
14
+ 3. *"WorkIQ failed → skip the source, no record."* (next refresh never retries; the gap is permanent)
15
+
16
+ All three are defects. This rule replaces them with a deterministic, auditable, **non-blocking** flow.
17
+
18
+ ## The rule (HARD)
19
+
20
+ When a WorkIQ call fails (auth error, empty after doubled-strict retry, throttled, CLI error, or any non-success), Kushi MUST:
21
+
22
+ 1. **NOT call Graph, `m365_get_*`, or any other M365 host tool as a fallback.** No exceptions. Even if the tool is right there and looks like it would work. The doctrine in `workiq-only.instructions.md` is absolute.
23
+ 2. **Write a deferred-retry marker** (see schema below).
24
+ 3. **Surface a one-liner** in coverage.md, the per-user run report, and the project's `bootstrap-status.md` `## Deferred Retries` section.
25
+ 4. **Continue the run** for all other sources. Never block the orchestrator on a single source's failure.
26
+ 5. **Inform the user** at end-of-run with the count of deferred items and the path to the queue directory.
27
+
28
+ The next `refresh-project` run drains the queue first (Step 2a). On success, the marker is deleted. On repeated failure, the marker's `attempts` counter increments and the user is re-informed.
29
+
30
+ ## Marker file location
31
+
32
+ ```
33
+ <engagement-root>/<project>/Evidence/<alias>/_deferred-retries/<YYYY-MM-DD-HHmm>_<source>_<short-reason>.yml
34
+ ```
35
+
36
+ - Per-contributor (`<alias>`) — never shared, so multi-user safety is moot.
37
+ - Sortable by filename (chronological).
38
+ - One marker per failed call. Do NOT batch — granular markers make retry deterministic.
39
+
40
+ ## Marker schema
41
+
42
+ ```yaml
43
+ # Deferred-retry marker — auto-generated. Do NOT hand-edit.
44
+ # Drained by refresh-project Step 2a. Deleted on retry success.
45
+ schema_version: 1
46
+ source: meetings # one of: email, teams, meetings, onenote, sharepoint, crm, ado, misc, identity
47
+ project: Northwind
48
+ alias: ushak
49
+ created_at: 2026-05-20T12:30:00Z
50
+ attempts: 1
51
+ last_attempt_at: 2026-05-20T12:30:00Z
52
+ window: { from: '2026-04-20', to: '2026-05-20' }
53
+ target:
54
+ # source-specific identifying fields — exactly what the retry needs to re-issue the call
55
+ subject: "JD FDE Intake"
56
+ date: "2026-05-13"
57
+ workiq:
58
+ command: 'workiq ask -q "Find the Teams meeting titled \"JD FDE Intake\" that occurred on 2026-05-13..."'
59
+ request_id: '54d9c6bc-6e56-43b6-9eb7-ac23e86e2cc0' # if WorkIQ returned one before failing
60
+ error_class: 'empty-after-doubled-strict' # auth-error | empty | empty-after-doubled-strict | throttled | cli-error | timeout
61
+ error_message: 'WorkIQ returned a summary only after both prompts.'
62
+ user_message: |
63
+ Could not retrieve the full verbatim transcript of "JD FDE Intake" (2026-05-13) via WorkIQ.
64
+ The next refresh will retry automatically. To populate now, paste the transcript into
65
+ Evidence/ushak/meetings/snapshot/2026-05-13_jd-fde-intake_transcript.md and mark this marker
66
+ resolved by deleting the file.
67
+ ```
68
+
69
+ ## Producer contract (every pull-* skill + identity-resolution)
70
+
71
+ Before considering a source "failed and skipped", the skill MUST:
72
+
73
+ 1. Call WorkIQ once with the canonical prompt from `workiq-only.instructions.md`.
74
+ 2. On weak result, call the doubled-strict retry prompt from the same table.
75
+ 3. If both fail:
76
+ - Write the marker per the schema above.
77
+ - Add a row to coverage.md: `Source: WorkIQ → DEFERRED (marker: <relative-path>)`.
78
+ - Continue the run. Do NOT throw. Do NOT call any other M365 tool.
79
+
80
+ Pseudocode (PowerShell shape):
81
+
82
+ ```powershell
83
+ $result = Invoke-WorkIQ -Query $canonical
84
+ if (-not (Test-Sufficient $result)) {
85
+ $result = Invoke-WorkIQ -Query $doubledStrict
86
+ }
87
+ if (-not (Test-Sufficient $result)) {
88
+ Write-DeferredRetryMarker -Source $src -Target $target -Window $win -Workiq $workiqMeta
89
+ Add-CoverageRow -Source 'WorkIQ' -Status 'DEFERRED' -MarkerPath $markerPath
90
+ return # CONTINUE the orchestrator with the next source. NEVER call m365_get_*.
91
+ }
92
+ ```
93
+
94
+ ## Consumer contract (refresh-project)
95
+
96
+ `refresh-project` SKILL Step 2a (NEW, REQUIRED) runs **before** the per-source dispatch loop:
97
+
98
+ ```
99
+ For each <alias>/_deferred-retries/*.yml in chronological order:
100
+ - Load marker
101
+ - Re-issue the canonical WorkIQ query with original window + target
102
+ - If success → write artifact to its canonical Evidence/ path, delete marker, log "drained" in refresh report
103
+ - If failure → increment attempts, update last_attempt_at, leave marker in place, log "still-deferred"
104
+ After drain → run normal Step 2 per-source dispatch
105
+ After Step 2 → report drain results in the run report's `## Deferred-retry drain` section
106
+ ```
107
+
108
+ If `attempts` reaches 5, do NOT keep silently retrying. Promote to a project-level Open Question:
109
+
110
+ ```
111
+ - [ ] DEFERRED-RETRY (5 attempts): <source> for <target>. See <marker-path>. Manual intervention required (paste verbatim, or remove the marker if no longer needed).
112
+ ```
113
+
114
+ ## bootstrap-status.md integration
115
+
116
+ `bootstrap-status-format.instructions.md` mandates a `## Deferred Retries` section. Format:
117
+
118
+ ```
119
+ ## Deferred Retries
120
+
121
+ | Source | Target | Attempts | Marker | First seen |
122
+ |---|---|---|---|---|
123
+ | meetings | JD FDE Intake 2026-05-13 | 1 | Evidence/ushak/_deferred-retries/2026-05-20-1230_meetings_empty.yml | 2026-05-20 |
124
+ ```
125
+
126
+ Section is omitted entirely when no markers exist.
127
+
128
+ ## What "informing the user" looks like
129
+
130
+ At end-of-run summary (every `pull-*`, `bootstrap-project`, `refresh-project`):
131
+
132
+ ```
133
+ ⚠ Deferred retries this run: 2 (will retry on next `refresh <project>`)
134
+ - meetings/JD FDE Intake 2026-05-13 → Evidence/ushak/_deferred-retries/2026-05-20-1230_meetings_empty.yml
135
+ - onenote/Architecture overview → Evidence/ushak/_deferred-retries/2026-05-20-1231_onenote_throttled.yml
136
+ ```
137
+
138
+ Never silent. Never collapsed. The user sees exactly which calls deferred and where to find the markers.
139
+
140
+ ## Anti-patterns (defects)
141
+
142
+ 1. **Calling `m365_get_*` / Graph REST after a WorkIQ failure.** FORBIDDEN. Even "just to check if it works." Even "as a last resort." Write the marker; move on.
143
+ 2. **Throwing / blocking the orchestrator on a single source's WorkIQ failure.** FORBIDDEN. Bootstrap and refresh dispatch every enabled source; a single failure must not stop the others.
144
+ 3. **Silently skipping a source with no marker.** FORBIDDEN. If WorkIQ failed and you did NOT write a marker, the user has no signal and `refresh` will never retry. Always mark.
145
+ 4. **Asking the user to paste mid-run as the primary recovery.** Pasting is a manual override the user MAY do later (by populating the artifact directly and deleting the marker). It is NOT the agent's recovery flow. The agent's recovery flow is: mark + continue + inform.
146
+ 5. **Promoting markers to OPEN-QUESTIONS-DRAFT.md before 5 attempts.** Too noisy. Let refresh drain naturally.
147
+ 6. **Storing markers outside `Evidence/<alias>/_deferred-retries/`.** Wrong location = the drainer can't find them. Wrong scope = breaks multi-user (markers are per-contributor by design).
148
+
149
+ ## Cross-references
150
+
151
+ - `workiq-only.instructions.md` — WorkIQ is the only path. This file defines what happens when that path fails.
152
+ - `identity-resolution.instructions.md` — "Failure modes" table now cites this rule.
153
+ - `bootstrap-status-format.instructions.md` — `## Deferred Retries` section contract.
154
+ - `multi-user-shared-files.instructions.md` — `_deferred-retries/` is per-contributor (under `Evidence/<alias>/`) so multi-user collision doctrine does not apply.
155
+ - `verbatim-by-default.instructions.md` — deferring is NOT a silent skip. A marker IS the audit trail.
@@ -1,123 +1,123 @@
1
- ---
2
- applyTo: "**"
3
- description: "Evidence layout is CANONICAL — every per-source artifact lives under <engagement-root>/<project>/Evidence/<alias>/<source>/{snapshot,stream,_index,_legacy,refresh-reports}/. Writing source artifacts to any other path under <project>/ (e.g. <project>/email-context/, <project>/notes/, <project>/_Weekly Summaries/, <project>/email/) is a DEFECT."
4
- ---
5
-
6
- # Evidence Layout — Canonical (HARD RULE)
7
-
8
- Multi-contributor projects depend on a **single, predictable, per-source, per-alias** evidence tree. The moment a pull skill writes to a sibling folder under `<project>/` (e.g. `<project>/email-context/`), four things break:
9
-
10
- 1. **Multi-user collision** — another contributor's pull cannot find or merge it.
11
- 2. **Consolidation breaks** — `consolidate-evidence` walks `Evidence/*/<source>/` and silently drops anything outside.
12
- 3. **State rebuilds wrong** — `build-state` reads only the canonical tree; rogue folders become invisible.
13
- 4. **Run-log drift** — `run-log.yml` watermarks point at the canonical path; a legacy folder makes the run "ok" but the data isn't where the doctrine says.
14
-
15
- This file is the **hard rule** every pull-/refresh-/bootstrap- skill MUST honor.
16
-
17
- ## The contract
18
-
19
- ### Rule 1 — All per-source artifacts live under `Evidence/<alias>/<source>/`
20
-
21
- For every project under `<engagement-root>/`:
22
-
23
- ```
24
- <engagement-root>/<project>/
25
- Evidence/ # ← ALL contributor evidence lives here
26
- contributors.yml
27
- run-log.yml
28
- _Consolidated/ # output of consolidate-evidence (cross-alias)
29
- <alias>/ # one per contributor (e.g. "ushak/")
30
- .settings.yml
31
- refresh-reports/
32
- open-questions/
33
- ado/ { weekly/ , _index/ } # legacy-read: snapshot/, stream/
34
- crm/ { weekly/ , _index/ } # legacy-read: snapshot/, stream/
35
- email/ { weekly/ , _index/ , _legacy_*/ } # legacy-read: snapshot/, stream/
36
- meetings/ { weekly/ , _index/ , verbatim/ } # verbatim/ is required (expiring source); legacy-read: snapshot/, stream/
37
- onenote/ { weekly/ , _index/ , refresh-reports/ } # legacy-read: snapshot/, stream/
38
- sharepoint/ { weekly/ , _index/ } # legacy-read: snapshot/, stream/
39
- teams/ { weekly/ , _index/ } # legacy-read: snapshot/, stream/
40
- State/ # rendered by build-state (read-only outcome)
41
- Reports/ # rendered by aggregate / fde-report (read-only)
42
- integrations.yml # per-project boundaries (scope-boundaries.instructions.md)
43
- ```
44
-
45
- `Evidence/` and `<alias>/` are the **only** levels a pull skill may create under `<project>/`. Nothing else.
46
-
47
- **v4.9.0 shape change:** pull-* skills now write a single `weekly/` folder per source + a thin
48
- `_index/entities.yml`, per `weekly-csc.instructions.md`. The old `snapshot/` + `stream/`
49
- folders are **legacy** — readers may still read them (for graceful migration), but no new
50
- writes go to them. `meetings/verbatim/<dir>/` is kept (the only expiring source). See
51
- `weekly-csc.instructions.md` for the writer/reader contracts.
52
-
53
- ### Rule 2 — Sibling source-output folders under `<project>/` are FORBIDDEN
54
-
55
- Concretely, a pull skill MUST NOT create or write to any of these (representative — list is illustrative, not exhaustive):
56
-
57
- | Forbidden path | Canonical replacement |
58
- |---|---|
59
- | `<project>/email-context/` | `<project>/Evidence/<alias>/email/weekly/` |
60
- | `<project>/email/` (at project root) | `<project>/Evidence/<alias>/email/` |
61
- | `<project>/notes/` | `<project>/Evidence/<alias>/onenote/weekly/` |
62
- | `<project>/_Weekly Summaries/` | `<project>/Evidence/<alias>/<source>/weekly/` |
63
- | `<project>/Meetings/` (at project root) | `<project>/Evidence/<alias>/meetings/` |
64
- | `<project>/Teams/` (at project root) | `<project>/Evidence/<alias>/teams/` |
65
- | `<project>/SharePoint/` (at project root) | `<project>/Evidence/<alias>/sharepoint/` |
66
- | `<project>/CRM/`, `<project>/ADO/` (at project root) | `<project>/Evidence/<alias>/{crm,ado}/` |
67
- | any `<project>/<source>-context/`, `<project>/<source>-summary/`, etc. | `<project>/Evidence/<alias>/<source>/weekly/` |
68
-
69
- `State/`, `Reports/`, `integrations.yml` are the **only** top-level siblings of `Evidence/` that pull/refresh skills are allowed to leave alone (they are written by `build-state`, `aggregate-project`, and bootstrap respectively — not by pull-* skills).
70
-
71
- ### Rule 3 — Legacy / pre-bootstrap folders are migrated, not deleted
72
-
73
- When a pull or refresh skill encounters a non-canonical source-output folder under `<project>/`:
74
-
75
- 1. **Move** the folder verbatim into `Evidence/<alias>/<source>/_legacy_<original-folder-name>_pre-bootstrap/` (preserve file mtimes; do not edit contents).
76
- 2. **Log** the move in the contributor's `refresh-reports/<YYYY-MM-DD-HHMM>_refresh.md` under a `## Layout migrations` section: source path → destination path → file count.
77
- 3. **Note** the migration as a `runs:` entry in `Evidence/run-log.yml` with `type: layout-migration` and `status: ok`.
78
- 4. **Do not delete** anything until the user explicitly acks in the next session.
79
-
80
- If alias is ambiguous (legacy folder pre-dates multi-user), default to the current contributor's alias and add a one-liner to `Evidence/<alias>/open-questions/layout.md` so the consolidation step can re-attribute later.
81
-
82
- ### Rule 4 — `consolidate-evidence`, `build-state`, and `aggregate-project` only read the canonical tree
83
-
84
- By contract, downstream skills walk:
85
-
86
- - `Evidence/*/email/`, `Evidence/*/teams/`, `Evidence/*/meetings/`, `Evidence/*/onenote/`, `Evidence/*/sharepoint/`, `Evidence/*/crm/`, `Evidence/*/ado/`
87
-
88
- Anything outside these paths is invisible to them — by design. The path IS the contract. There is no "also scan sibling folders" fallback.
89
-
90
- ### Rule 5 — Self-check enforces the rule (`self-check D14`)
91
-
92
- `plugin/skills/self-check/run.ps1` -Deep MUST detect any `<project>/<sibling>/` folder under engagement roots where:
93
-
94
- - `<sibling>` is not in the allow-list `@('Evidence','State','Reports','.kushi','.kushi-reference','.vscode')`, AND
95
- - `<sibling>` contains markdown files matching the per-source patterns (`*-summary.md`, `*-stream.md`, `*-context*`, `current-state.md`, `index.md`, etc.).
96
-
97
- When detected → emit a D14 finding with the canonical replacement path from Rule 2.
98
-
99
- ## Why this is HARD, not "preferred"
100
-
101
- Multi-contributor evidence only works if every pull writes to the **same path** another contributor's pull would write to. The instant one skill writes to `<project>/email-context/` and another writes to `Evidence/ushak/email/`, the project has two parallel realities — and `build-state` will quietly use only one of them. That's a citation-integrity defect, not a cosmetic one.
102
-
103
- This rule is the layout half of the partial-determinism contract:
104
-
105
- - `scope-boundaries.instructions.md` → user controls **what** is queried.
106
- - `evidence-layout-canonical.instructions.md` (this file) → doctrine controls **where** the result lands.
107
-
108
- Together they guarantee that two contributors running the same verb on the same project produce evidence in the same place, scoped to the same boundary, regardless of which one ran first.
109
-
110
- ## Cross-references
111
-
112
- - `weekly-csc.instructions.md` — the v4.9.0 layout inside each `<source>/` folder (weekly/ + _index/).
113
- - `snapshot-vs-stream.instructions.md` — DEPRECATED v4.9.0; legacy two-folder model.
114
- - `comprehensive-structured-capture.instructions.md` — the v4.9.0 block shape inside weekly/ files.
115
- - `scope-boundaries.instructions.md` — what each source is allowed to query (orthogonal: scope vs path).
116
- - `side-by-side-config.instructions.md` — config files (mutable hints, integrations.yml) live under `<workspace>/.kushi/config/` (v4.4.0+, was `<engagement-root>/.project-evidence/`).
117
- - `run-reports.instructions.md` — every layout-migration MUST appear in the refresh report.
118
- - `cleanup-on-resolution.instructions.md` — once a legacy folder is migrated, all stale references in older summaries/notes get rewritten in the same turn.
119
- - `bootstrap-project/SKILL.md` — creates the canonical tree on first run.
120
- - `refresh-project/SKILL.md` — migrates any non-canonical folders it finds before pulling.
121
- - All `pull-*/SKILL.md` — write ONLY under `Evidence/<alias>/<source>/`.
122
- - `consolidate-evidence/SKILL.md`, `build-state/SKILL.md`, `aggregate-project/SKILL.md` — read ONLY from the canonical tree.
123
- - `self-check/run.ps1` D14 — enforces detection.
1
+ ---
2
+ applyTo: "**"
3
+ description: "Evidence layout is CANONICAL — every per-source artifact lives under <engagement-root>/<project>/Evidence/<alias>/<source>/{snapshot,stream,_index,_legacy,refresh-reports}/. Writing source artifacts to any other path under <project>/ (e.g. <project>/email-context/, <project>/notes/, <project>/_Weekly Summaries/, <project>/email/) is a DEFECT."
4
+ ---
5
+
6
+ # Evidence Layout — Canonical (HARD RULE)
7
+
8
+ Multi-contributor projects depend on a **single, predictable, per-source, per-alias** evidence tree. The moment a pull skill writes to a sibling folder under `<project>/` (e.g. `<project>/email-context/`), four things break:
9
+
10
+ 1. **Multi-user collision** — another contributor's pull cannot find or merge it.
11
+ 2. **Consolidation breaks** — `consolidate-evidence` walks `Evidence/*/<source>/` and silently drops anything outside.
12
+ 3. **State rebuilds wrong** — `build-state` reads only the canonical tree; rogue folders become invisible.
13
+ 4. **Run-log drift** — `run-log.yml` watermarks point at the canonical path; a legacy folder makes the run "ok" but the data isn't where the doctrine says.
14
+
15
+ This file is the **hard rule** every pull-/refresh-/bootstrap- skill MUST honor.
16
+
17
+ ## The contract
18
+
19
+ ### Rule 1 — All per-source artifacts live under `Evidence/<alias>/<source>/`
20
+
21
+ For every project under `<engagement-root>/`:
22
+
23
+ ```
24
+ <engagement-root>/<project>/
25
+ Evidence/ # ← ALL contributor evidence lives here
26
+ contributors.yml
27
+ run-log.yml
28
+ _Consolidated/ # output of consolidate-evidence (cross-alias)
29
+ <alias>/ # one per contributor (e.g. "ushak/")
30
+ .settings.yml
31
+ refresh-reports/
32
+ open-questions/
33
+ ado/ { weekly/ , _index/ } # legacy-read: snapshot/, stream/
34
+ crm/ { weekly/ , _index/ } # legacy-read: snapshot/, stream/
35
+ email/ { weekly/ , _index/ , _legacy_*/ } # legacy-read: snapshot/, stream/
36
+ meetings/ { weekly/ , _index/ , verbatim/ } # verbatim/ is required (expiring source); legacy-read: snapshot/, stream/
37
+ onenote/ { weekly/ , _index/ , refresh-reports/ } # legacy-read: snapshot/, stream/
38
+ sharepoint/ { weekly/ , _index/ } # legacy-read: snapshot/, stream/
39
+ teams/ { weekly/ , _index/ } # legacy-read: snapshot/, stream/
40
+ State/ # rendered by build-state (read-only outcome)
41
+ Reports/ # rendered by aggregate / fde-report (read-only)
42
+ integrations.yml # per-project boundaries (scope-boundaries.instructions.md)
43
+ ```
44
+
45
+ `Evidence/` and `<alias>/` are the **only** levels a pull skill may create under `<project>/`. Nothing else.
46
+
47
+ **v4.9.0 shape change:** pull-* skills now write a single `weekly/` folder per source + a thin
48
+ `_index/entities.yml`, per `weekly-csc.instructions.md`. The old `snapshot/` + `stream/`
49
+ folders are **legacy** — readers may still read them (for graceful migration), but no new
50
+ writes go to them. `meetings/verbatim/<dir>/` is kept (the only expiring source). See
51
+ `weekly-csc.instructions.md` for the writer/reader contracts.
52
+
53
+ ### Rule 2 — Sibling source-output folders under `<project>/` are FORBIDDEN
54
+
55
+ Concretely, a pull skill MUST NOT create or write to any of these (representative — list is illustrative, not exhaustive):
56
+
57
+ | Forbidden path | Canonical replacement |
58
+ |---|---|
59
+ | `<project>/email-context/` | `<project>/Evidence/<alias>/email/weekly/` |
60
+ | `<project>/email/` (at project root) | `<project>/Evidence/<alias>/email/` |
61
+ | `<project>/notes/` | `<project>/Evidence/<alias>/onenote/weekly/` |
62
+ | `<project>/_Weekly Summaries/` | `<project>/Evidence/<alias>/<source>/weekly/` |
63
+ | `<project>/Meetings/` (at project root) | `<project>/Evidence/<alias>/meetings/` |
64
+ | `<project>/Teams/` (at project root) | `<project>/Evidence/<alias>/teams/` |
65
+ | `<project>/SharePoint/` (at project root) | `<project>/Evidence/<alias>/sharepoint/` |
66
+ | `<project>/CRM/`, `<project>/ADO/` (at project root) | `<project>/Evidence/<alias>/{crm,ado}/` |
67
+ | any `<project>/<source>-context/`, `<project>/<source>-summary/`, etc. | `<project>/Evidence/<alias>/<source>/weekly/` |
68
+
69
+ `State/`, `Reports/`, `integrations.yml` are the **only** top-level siblings of `Evidence/` that pull/refresh skills are allowed to leave alone (they are written by `build-state`, `aggregate-project`, and bootstrap respectively — not by pull-* skills).
70
+
71
+ ### Rule 3 — Legacy / pre-bootstrap folders are migrated, not deleted
72
+
73
+ When a pull or refresh skill encounters a non-canonical source-output folder under `<project>/`:
74
+
75
+ 1. **Move** the folder verbatim into `Evidence/<alias>/<source>/_legacy_<original-folder-name>_pre-bootstrap/` (preserve file mtimes; do not edit contents).
76
+ 2. **Log** the move in the contributor's `refresh-reports/<YYYY-MM-DD-HHMM>_refresh.md` under a `## Layout migrations` section: source path → destination path → file count.
77
+ 3. **Note** the migration as a `runs:` entry in `Evidence/run-log.yml` with `type: layout-migration` and `status: ok`.
78
+ 4. **Do not delete** anything until the user explicitly acks in the next session.
79
+
80
+ If alias is ambiguous (legacy folder pre-dates multi-user), default to the current contributor's alias and add a one-liner to `Evidence/<alias>/open-questions/layout.md` so the consolidation step can re-attribute later.
81
+
82
+ ### Rule 4 — `consolidate-evidence`, `build-state`, and `aggregate-project` only read the canonical tree
83
+
84
+ By contract, downstream skills walk:
85
+
86
+ - `Evidence/*/email/`, `Evidence/*/teams/`, `Evidence/*/meetings/`, `Evidence/*/onenote/`, `Evidence/*/sharepoint/`, `Evidence/*/crm/`, `Evidence/*/ado/`
87
+
88
+ Anything outside these paths is invisible to them — by design. The path IS the contract. There is no "also scan sibling folders" fallback.
89
+
90
+ ### Rule 5 — Self-check enforces the rule (`self-check D14`)
91
+
92
+ `plugin/skills/self-check/run.ps1` -Deep MUST detect any `<project>/<sibling>/` folder under engagement roots where:
93
+
94
+ - `<sibling>` is not in the allow-list `@('Evidence','State','Reports','.kushi','.kushi-reference','.vscode')`, AND
95
+ - `<sibling>` contains markdown files matching the per-source patterns (`*-summary.md`, `*-stream.md`, `*-context*`, `current-state.md`, `index.md`, etc.).
96
+
97
+ When detected → emit a D14 finding with the canonical replacement path from Rule 2.
98
+
99
+ ## Why this is HARD, not "preferred"
100
+
101
+ Multi-contributor evidence only works if every pull writes to the **same path** another contributor's pull would write to. The instant one skill writes to `<project>/email-context/` and another writes to `Evidence/ushak/email/`, the project has two parallel realities — and `build-state` will quietly use only one of them. That's a citation-integrity defect, not a cosmetic one.
102
+
103
+ This rule is the layout half of the partial-determinism contract:
104
+
105
+ - `scope-boundaries.instructions.md` → user controls **what** is queried.
106
+ - `evidence-layout-canonical.instructions.md` (this file) → doctrine controls **where** the result lands.
107
+
108
+ Together they guarantee that two contributors running the same verb on the same project produce evidence in the same place, scoped to the same boundary, regardless of which one ran first.
109
+
110
+ ## Cross-references
111
+
112
+ - `weekly-csc.instructions.md` — the v4.9.0 layout inside each `<source>/` folder (weekly/ + _index/).
113
+ - `snapshot-vs-stream.instructions.md` — DEPRECATED v4.9.0; legacy two-folder model.
114
+ - `comprehensive-structured-capture.instructions.md` — the v4.9.0 block shape inside weekly/ files.
115
+ - `scope-boundaries.instructions.md` — what each source is allowed to query (orthogonal: scope vs path).
116
+ - `side-by-side-config.instructions.md` — config files (mutable hints, integrations.yml) live under `<workspace>/.kushi/config/` (v4.4.0+, was `<engagement-root>/.project-evidence/`).
117
+ - `run-reports.instructions.md` — every layout-migration MUST appear in the refresh report.
118
+ - `cleanup-on-resolution.instructions.md` — once a legacy folder is migrated, all stale references in older summaries/notes get rewritten in the same turn.
119
+ - `bootstrap-project/SKILL.md` — creates the canonical tree on first run.
120
+ - `refresh-project/SKILL.md` — migrates any non-canonical folders it finds before pulling.
121
+ - All `pull-*/SKILL.md` — write ONLY under `Evidence/<alias>/<source>/`.
122
+ - `consolidate-evidence/SKILL.md`, `build-state/SKILL.md`, `aggregate-project/SKILL.md` — read ONLY from the canonical tree.
123
+ - `self-check/run.ps1` D14 — enforces detection.