@rubytech/create-sitedesk-code 0.1.524 → 0.1.525

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 (117) hide show
  1. package/package.json +1 -1
  2. package/payload/platform/plugins/admin/skills/superpowers-sprint/SKILL.md +26 -0
  3. package/payload/platform/plugins/admin/skills/whats-new/SKILL.md +6 -0
  4. package/payload/platform/plugins/memory/PLUGIN.md +10 -0
  5. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/compiled-truth-revision.test.js +5 -1
  6. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/compiled-truth-revision.test.js.map +1 -1
  7. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/temporal-type-preserve.test.d.ts +2 -0
  8. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/temporal-type-preserve.test.d.ts.map +1 -0
  9. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/temporal-type-preserve.test.js +141 -0
  10. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/temporal-type-preserve.test.js.map +1 -0
  11. package/payload/platform/plugins/memory/mcp/dist/lib/log-ingest.d.ts +1 -1
  12. package/payload/platform/plugins/memory/mcp/dist/lib/log-ingest.d.ts.map +1 -1
  13. package/payload/platform/plugins/memory/mcp/dist/lib/log-ingest.js +6 -0
  14. package/payload/platform/plugins/memory/mcp/dist/lib/log-ingest.js.map +1 -1
  15. package/payload/platform/plugins/memory/mcp/dist/lib/temporal-type-preserve.d.ts +45 -0
  16. package/payload/platform/plugins/memory/mcp/dist/lib/temporal-type-preserve.d.ts.map +1 -0
  17. package/payload/platform/plugins/memory/mcp/dist/lib/temporal-type-preserve.js +122 -0
  18. package/payload/platform/plugins/memory/mcp/dist/lib/temporal-type-preserve.js.map +1 -0
  19. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-by-name.test.js +26 -0
  20. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-by-name.test.js.map +1 -1
  21. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-type-preserve.test.d.ts +2 -0
  22. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-type-preserve.test.d.ts.map +1 -0
  23. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-type-preserve.test.js +201 -0
  24. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-type-preserve.test.js.map +1 -0
  25. package/payload/platform/plugins/memory/mcp/dist/tools/memory-update.d.ts.map +1 -1
  26. package/payload/platform/plugins/memory/mcp/dist/tools/memory-update.js +89 -33
  27. package/payload/platform/plugins/memory/mcp/dist/tools/memory-update.js.map +1 -1
  28. package/payload/platform/plugins/memory/mcp/vitest.config.ts +2 -0
  29. package/payload/platform/plugins/scheduling/PLUGIN.md +6 -0
  30. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/meeting-retype.test.d.ts +2 -0
  31. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/meeting-retype.test.d.ts.map +1 -0
  32. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/meeting-retype.test.js +148 -0
  33. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/meeting-retype.test.js.map +1 -0
  34. package/payload/platform/plugins/scheduling/mcp/dist/lib/booking-reconcile.d.ts +83 -6
  35. package/payload/platform/plugins/scheduling/mcp/dist/lib/booking-reconcile.d.ts.map +1 -1
  36. package/payload/platform/plugins/scheduling/mcp/dist/lib/booking-reconcile.js +90 -5
  37. package/payload/platform/plugins/scheduling/mcp/dist/lib/booking-reconcile.js.map +1 -1
  38. package/payload/platform/plugins/scheduling/mcp/dist/scripts/__tests__/routine-roster-audit.test.js +111 -2
  39. package/payload/platform/plugins/scheduling/mcp/dist/scripts/__tests__/routine-roster-audit.test.js.map +1 -1
  40. package/payload/platform/plugins/scheduling/mcp/dist/scripts/agent-turn-dispatch.d.ts +38 -0
  41. package/payload/platform/plugins/scheduling/mcp/dist/scripts/agent-turn-dispatch.d.ts.map +1 -1
  42. package/payload/platform/plugins/scheduling/mcp/dist/scripts/agent-turn-dispatch.js +116 -0
  43. package/payload/platform/plugins/scheduling/mcp/dist/scripts/agent-turn-dispatch.js.map +1 -1
  44. package/payload/platform/plugins/scheduling/mcp/dist/scripts/check-due-events.js +13 -1
  45. package/payload/platform/plugins/scheduling/mcp/dist/scripts/check-due-events.js.map +1 -1
  46. package/payload/platform/plugins/scheduling/mcp/dist/scripts/reconcile-bookings.js +81 -8
  47. package/payload/platform/plugins/scheduling/mcp/dist/scripts/reconcile-bookings.js.map +1 -1
  48. package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-event-agent.test.js +39 -0
  49. package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-event-agent.test.js.map +1 -1
  50. package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-event.d.ts.map +1 -1
  51. package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-event.js +9 -1
  52. package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-event.js.map +1 -1
  53. package/payload/platform/scripts/__tests__/check-canonical-tool-names.test.sh +162 -0
  54. package/payload/platform/scripts/__tests__/check-no-task-id-leaks.test.sh +53 -0
  55. package/payload/platform/scripts/__tests__/task-id-citation.test.sh +72 -0
  56. package/payload/platform/scripts/check-canonical-tool-names.mjs +36 -4
  57. package/payload/platform/scripts/check-no-task-id-leaks.mjs +80 -62
  58. package/payload/platform/scripts/lib/canonical-tool-names.mjs +130 -26
  59. package/payload/platform/scripts/lib/task-id-citation.mjs +67 -0
  60. package/payload/platform/.docs/search-surface-contract.md +0 -58
  61. package/payload/platform/docs/superpowers/plans/2026-06-02-task-610-follower-202-retry.md +0 -372
  62. package/payload/platform/docs/superpowers/plans/2026-06-04-public-agent-knowledge-delivery.md +0 -230
  63. package/payload/platform/docs/superpowers/plans/2026-06-23-account-filesystem-schema.md +0 -544
  64. package/payload/platform/docs/superpowers/plans/2026-07-11-task-1557-operator-on-behalf-preference-attribution.md +0 -542
  65. package/payload/platform/docs/superpowers/plans/2026-07-13-account-schema-ontology-projection.md +0 -547
  66. package/payload/platform/docs/superpowers/plans/2026-07-14-graph-top-level-labels-ontology-single-source.md +0 -458
  67. package/payload/platform/docs/superpowers/plans/2026-07-17-task-1736-retire-mcp-stderr-tee.md +0 -397
  68. package/payload/platform/docs/superpowers/plans/2026-07-18-graph-native-ledger.md +0 -807
  69. package/payload/platform/docs/superpowers/plans/2026-07-18-ledger-write-path-fix.md +0 -109
  70. package/payload/platform/docs/superpowers/plans/2026-07-20-storage-pages-create.md +0 -82
  71. package/payload/platform/docs/superpowers/plans/2026-07-20-task-1704-data-portal-standing-audit.md +0 -673
  72. package/payload/platform/docs/superpowers/plans/2026-07-20-task-1789-reseat-channel-row-fork.md +0 -1244
  73. package/payload/platform/docs/superpowers/plans/2026-07-20-task-1818-loop-gate-app-routes.md +0 -462
  74. package/payload/platform/docs/superpowers/plans/2026-07-20-task-1819-top-level-label-allowlist.md +0 -321
  75. package/payload/platform/docs/superpowers/plans/2026-07-20-task-1829-platform-ui-typecheck.md +0 -830
  76. package/payload/platform/docs/superpowers/plans/2026-07-20-task-1831-data-portal-class-derived-allowlist.md +0 -2177
  77. package/payload/platform/docs/superpowers/plans/2026-07-21-graph-caption-resolver.md +0 -124
  78. package/payload/platform/docs/superpowers/plans/2026-07-21-task-1877-bash-schema-enforcement.md +0 -107
  79. package/payload/platform/docs/superpowers/plans/2026-07-21-task-1887-reconcile-allowed-top-level.md +0 -205
  80. package/payload/platform/docs/superpowers/plans/2026-07-22-task-1899-reconcile-report-only.md +0 -748
  81. package/payload/platform/docs/superpowers/plans/2026-07-22-task-1910-two-way-portal-exchange.md +0 -1716
  82. package/payload/platform/docs/superpowers/plans/2026-07-23-task-1930-adherence-enforcement.md +0 -422
  83. package/payload/platform/docs/superpowers/plans/2026-07-24-task-1942-subaccount-switcher-brand-head.md +0 -327
  84. package/payload/platform/docs/superpowers/plans/2026-07-25-task-1974-uploads-intake-inbox.md +0 -235
  85. package/payload/platform/docs/superpowers/plans/2026-07-25-task-1976-intra-folder-hygiene.md +0 -215
  86. package/payload/platform/docs/superpowers/plans/2026-07-26-task-1902-account-owned-entry-declarations.md +0 -555
  87. package/payload/platform/docs/superpowers/plans/2026-07-26-task-1926-portal-push-concurrency-guard.md +0 -482
  88. package/payload/platform/docs/superpowers/plans/2026-07-26-task-2023-sidebar-sessions-async-reads.md +0 -394
  89. package/payload/platform/docs/superpowers/plans/2026-07-27-task-2016-disabled-agent-routing.md +0 -624
  90. package/payload/platform/docs/superpowers/plans/2026-07-27-task-2028-declared-file-write-deny.md +0 -303
  91. package/payload/platform/docs/superpowers/plans/2026-07-27-task-2052-account-machinery-write-fence.md +0 -250
  92. package/payload/platform/docs/superpowers/plans/2026-07-28-task-2097-email-signature-set.md +0 -65
  93. package/payload/platform/docs/superpowers/specs/2026-06-02-task-610-follower-202-retry-design.md +0 -116
  94. package/payload/platform/docs/superpowers/specs/2026-06-23-account-filesystem-schema-design.md +0 -170
  95. package/payload/platform/docs/superpowers/specs/2026-07-11-task-1557-operator-on-behalf-preference-attribution-design.md +0 -90
  96. package/payload/platform/docs/superpowers/specs/2026-07-13-account-schema-ontology-projection-design.md +0 -178
  97. package/payload/platform/docs/superpowers/specs/2026-07-14-graph-top-level-labels-ontology-single-source-design.md +0 -119
  98. package/payload/platform/docs/superpowers/specs/2026-07-17-task-1736-retire-mcp-stderr-tee-design.md +0 -128
  99. package/payload/platform/docs/superpowers/specs/2026-07-18-graph-native-ledger-design.md +0 -241
  100. package/payload/platform/docs/superpowers/specs/2026-07-20-task-1704-data-portal-standing-audit-design.md +0 -177
  101. package/payload/platform/docs/superpowers/specs/2026-07-20-task-1789-reseat-channel-row-fork-design.md +0 -201
  102. package/payload/platform/docs/superpowers/specs/2026-07-20-task-1818-loop-gate-app-routes-design.md +0 -217
  103. package/payload/platform/docs/superpowers/specs/2026-07-20-task-1819-top-level-label-allowlist-design.md +0 -80
  104. package/payload/platform/docs/superpowers/specs/2026-07-20-task-1820-cpu-triage-admin-tools-design.md +0 -97
  105. package/payload/platform/docs/superpowers/specs/2026-07-20-task-1829-platform-ui-typecheck-design.md +0 -163
  106. package/payload/platform/docs/superpowers/specs/2026-07-20-task-1831-data-portal-class-derived-allowlist-design.md +0 -163
  107. package/payload/platform/docs/superpowers/specs/2026-07-22-task-1899-reconcile-report-only-design.md +0 -121
  108. package/payload/platform/docs/superpowers/specs/2026-07-22-task-1910-two-way-portal-exchange-design.md +0 -103
  109. package/payload/platform/docs/superpowers/specs/2026-07-23-task-1930-adherence-enforcement-design.md +0 -81
  110. package/payload/platform/docs/superpowers/specs/2026-07-24-task-1942-subaccount-switcher-brand-head-design.md +0 -35
  111. package/payload/platform/docs/superpowers/specs/2026-07-26-task-1902-account-owned-entry-declarations-design.md +0 -232
  112. package/payload/platform/docs/superpowers/specs/2026-07-26-task-1926-portal-push-concurrency-guard-design.md +0 -200
  113. package/payload/platform/docs/superpowers/specs/2026-07-26-task-2014-ui-suite-nondeterminism-design.md +0 -169
  114. package/payload/platform/docs/superpowers/specs/2026-07-27-task-2016-disabled-agent-routing-design.md +0 -139
  115. package/payload/platform/docs/superpowers/specs/2026-07-27-task-2028-declared-file-write-deny-design.md +0 -127
  116. package/payload/platform/docs/superpowers/specs/2026-07-27-task-2052-account-machinery-write-fence-design.md +0 -150
  117. package/payload/platform/docs/superpowers/specs/2026-07-28-task-2097-email-signature-set-design.md +0 -155
@@ -1,372 +0,0 @@
1
- # Follower 202 Cold-Start Retry Implementation Plan
2
-
3
- > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4
-
5
- **Goal:** Make the channel-pty-bridge JSONL follower survive the cold-spawn `202 {pending:true}` window so a fresh public webchat turn detects `end_turn` and the visitor receives the greeting instead of a 120s timeout.
6
-
7
- **Architecture:** Wrap the follower's single `fetch(/log?follow=1)` in a bounded retry loop. `202` triggers a logged retry on a poll interval until a `200` stream arrives or a give-up window elapses; `200` proceeds into the existing read/fan-out loop unchanged; other non-ok statuses keep today's `onError`+`onClose`. Two env vars (give-up window, poll interval) tune the loop, defaulting to cover claude cold-boot. The manager is untouched.
8
-
9
- **Tech Stack:** TypeScript, Node fetch + ReadableStream, vitest. Files in `maxy-code/platform/ui/app/lib/channel-pty-bridge/`.
10
-
11
- ---
12
-
13
- ### Task 1: Extend the test fetch helper to script a follow-response sequence
14
-
15
- The current `installManagerFetch` always answers `/log?follow=1` with a `200` stream. To
16
- test the `202`→`200` path we need to script per-sessionId follow responses: a list of
17
- statuses where `202` returns the pending JSON body and `200` returns the stream.
18
-
19
- **Files:**
20
- - Modify: `maxy-code/platform/ui/app/lib/channel-pty-bridge/__tests__/helpers.ts`
21
-
22
- - [ ] **Step 1: Add a `followStatuses` option and apply it in the follow branch**
23
-
24
- In `ManagerFetchOptions`, add:
25
-
26
- ```ts
27
- /** Per-sessionId status sequence for /:id/log?follow=1. Each 202 returns
28
- * `{pending:true}` and consumes one entry; the first non-202 entry returns
29
- * the stream (200) or an error body. Cycles the last entry. When unset, the
30
- * follow branch returns 200 + stream as before. */
31
- followStatuses?: Record<string, number[]>
32
- ```
33
-
34
- In `installManagerFetch`, before the `fetchMock` definition:
35
-
36
- ```ts
37
- const followStatusSeq = opts.followStatuses ?? {}
38
- const followStatusIdx: Record<string, number> = {}
39
- ```
40
-
41
- Replace the existing follow branch body (the `if (followMatch && method === 'GET')` block)
42
- with:
43
-
44
- ```ts
45
- const followMatch = url.match(/\/([^/?]+)\/log\?follow=1$/)
46
- if (followMatch && method === 'GET') {
47
- const sessionId = followMatch[1]
48
- followCalls.push(sessionId)
49
- const seq = followStatusSeq[sessionId]
50
- if (seq && seq.length > 0) {
51
- const i = Math.min(followStatusIdx[sessionId] ?? 0, seq.length - 1)
52
- followStatusIdx[sessionId] = (followStatusIdx[sessionId] ?? 0) + 1
53
- const status = seq[i]
54
- if (status === 202) {
55
- return new Response(JSON.stringify({ jsonlPath: null, exists: false, sizeBytes: 0, pending: true }), {
56
- status: 202,
57
- headers: { 'content-type': 'application/json' },
58
- })
59
- }
60
- }
61
- const stream = perId[sessionId] ?? defaultFollow ?? makeJsonlStream()
62
- return new Response(stream.body, {
63
- status: 200,
64
- headers: { 'content-type': 'application/x-ndjson' },
65
- })
66
- }
67
- ```
68
-
69
- - [ ] **Step 2: Confirm the existing follower suite still compiles and passes**
70
-
71
- Run: `cd maxy-code/platform && npx vitest run ui/app/lib/channel-pty-bridge/__tests__/follower.test.ts`
72
- Expected: PASS (4 tests) — the helper change is additive; `followStatuses` is unset in
73
- every existing test so the follow branch behaves exactly as before.
74
-
75
- - [ ] **Step 3: Commit**
76
-
77
- ```bash
78
- git add maxy-code/platform/ui/app/lib/channel-pty-bridge/__tests__/helpers.ts
79
- git commit -m "test(610): scriptable follow-response sequence in manager fetch helper"
80
- ```
81
-
82
- ---
83
-
84
- ### Task 2: Failing test — follower retries on 202 then fans out on the 200 stream
85
-
86
- **Files:**
87
- - Modify: `maxy-code/platform/ui/app/lib/channel-pty-bridge/__tests__/follower.test.ts`
88
-
89
- - [ ] **Step 1: Write the failing test**
90
-
91
- Add inside the `describe('follower', …)` block (the `makeEntry` helper and imports already
92
- exist at the top of the file):
93
-
94
- ```ts
95
- it('retries on 202 pending then fans out once the 200 stream is available', async () => {
96
- const stream = makeJsonlStream()
97
- // First follow fetch → 202 pending; second → 200 + stream.
98
- mgr = installManagerFetch({
99
- followStream: stream,
100
- followStatuses: { 'sess-aaaaaaaa': [202, 200] },
101
- })
102
- process.env.CHANNEL_PTY_FOLLOWER_RETRY_MS = '5'
103
- process.env.CHANNEL_PTY_FOLLOWER_PENDING_MAX_MS = '5000'
104
- const entry = makeEntry()
105
- const received: string[] = []
106
- entry.subscribers.add((text) => {
107
- received.push(text)
108
- })
109
- startFollower({ entry, tag: '[test]', onClose: () => {} })
110
- // Wait until the retry loop has issued the second (200) follow fetch.
111
- await waitFor(() => mgr.followCalls.length >= 2)
112
- stream.push(
113
- JSON.stringify({
114
- type: 'assistant',
115
- message: { content: [{ type: 'text', text: 'greeting' }], stop_reason: 'end_turn' },
116
- }),
117
- )
118
- await waitFor(() => received.length > 0)
119
- expect(received).toEqual(['greeting'])
120
- })
121
- ```
122
-
123
- Add to the `afterEach` (or a dedicated cleanup) so the env vars don't leak into other
124
- tests — place these two lines in the existing `afterEach` callback:
125
-
126
- ```ts
127
- delete process.env.CHANNEL_PTY_FOLLOWER_RETRY_MS
128
- delete process.env.CHANNEL_PTY_FOLLOWER_PENDING_MAX_MS
129
- ```
130
-
131
- - [ ] **Step 2: Run test to verify it fails**
132
-
133
- Run: `cd maxy-code/platform && npx vitest run ui/app/lib/channel-pty-bridge/__tests__/follower.test.ts -t "retries on 202"`
134
- Expected: FAIL — today the follower treats `202` as success, consumes the pending JSON
135
- body as a single non-event line, reads `done`, and closes. `mgr.followCalls.length` never
136
- reaches 2 (no retry), so `waitFor` throws "predicate never became true".
137
-
138
- - [ ] **Step 3: Commit the failing test**
139
-
140
- ```bash
141
- git add maxy-code/platform/ui/app/lib/channel-pty-bridge/__tests__/follower.test.ts
142
- git commit -m "test(610): failing test for follower 202 retry then fan-out"
143
- ```
144
-
145
- ---
146
-
147
- ### Task 3: Implement the bounded 202 retry loop in the follower
148
-
149
- **Files:**
150
- - Modify: `maxy-code/platform/ui/app/lib/channel-pty-bridge/follower.ts`
151
-
152
- - [ ] **Step 1: Add the two config readers**
153
-
154
- Below the imports (after the `type JsonlEvent = …` line, before `FollowerOptions`), add:
155
-
156
- ```ts
157
- function followerPendingMaxMs(): number {
158
- return Number(process.env.CHANNEL_PTY_FOLLOWER_PENDING_MAX_MS ?? String(120_000))
159
- }
160
-
161
- function followerRetryMs(): number {
162
- return Number(process.env.CHANNEL_PTY_FOLLOWER_RETRY_MS ?? String(1_000))
163
- }
164
- ```
165
-
166
- - [ ] **Step 2: Replace the single-fetch guard with the retry loop**
167
-
168
- Replace this block (currently `follower.ts:42-51`):
169
-
170
- ```ts
171
- try {
172
- const res = await fetch(managerLogFollowUrl(entry.sessionId), {
173
- signal: abort.signal,
174
- })
175
- if (!res.ok || !res.body) {
176
- opts.onError?.(`follow-status-${res.status}`)
177
- opts.onClose()
178
- return
179
- }
180
- const reader = res.body.getReader()
181
- ```
182
-
183
- with:
184
-
185
- ```ts
186
- try {
187
- const sid = entry.sessionId.slice(0, 8)
188
- const deadline = Date.now() + followerPendingMaxMs()
189
- let res: Response
190
- let attempt = 0
191
- for (;;) {
192
- res = await fetch(managerLogFollowUrl(entry.sessionId), {
193
- signal: abort.signal,
194
- })
195
- console.error(`${tag} follower-connect sessionId=${sid} status=${res.status}`)
196
- // 202 {pending:true}: the PTY is live but claude has not flushed its
197
- // first JSONL line yet (cold-spawn window). Retry on a poll interval
198
- // until a 200 stream is available or the give-up window elapses.
199
- if (res.status === 202) {
200
- attempt += 1
201
- await res.body?.cancel().catch(() => {})
202
- if (abort.signal.aborted) {
203
- opts.onClose()
204
- return
205
- }
206
- if (Date.now() >= deadline) {
207
- console.error(`${tag} follower-give-up sessionId=${sid} reason=pending-timeout attempts=${attempt}`)
208
- opts.onError?.('follow-pending-timeout')
209
- opts.onClose()
210
- return
211
- }
212
- console.error(`${tag} follower-retry sessionId=${sid} attempt=${attempt} reason=pending`)
213
- await new Promise((r) => setTimeout(r, followerRetryMs()))
214
- if (abort.signal.aborted) {
215
- opts.onClose()
216
- return
217
- }
218
- continue
219
- }
220
- break
221
- }
222
- if (!res.ok || !res.body) {
223
- opts.onError?.(`follow-status-${res.status}`)
224
- opts.onClose()
225
- return
226
- }
227
- console.error(`${tag} follower-open sessionId=${sid}`)
228
- const reader = res.body.getReader()
229
- ```
230
-
231
- The rest of the function (the `while (!abort.signal.aborted)` read loop, the `catch`, and
232
- the `finally → opts.onClose()`) is unchanged. `onClose` still fires exactly once on every
233
- exit path: each early `return` inside the loop calls `onClose()` directly and returns
234
- before the read loop; the normal stream-end / abort / error paths fall through to the
235
- existing `finally`.
236
-
237
- - [ ] **Step 3: Run the new test to verify it passes**
238
-
239
- Run: `cd maxy-code/platform && npx vitest run ui/app/lib/channel-pty-bridge/__tests__/follower.test.ts -t "retries on 202"`
240
- Expected: PASS — first fetch returns 202, follower logs `follower-retry`, second fetch
241
- returns the 200 stream, `follower-open` logs, the `end_turn` record fans out `'greeting'`.
242
-
243
- - [ ] **Step 4: Commit**
244
-
245
- ```bash
246
- git add maxy-code/platform/ui/app/lib/channel-pty-bridge/follower.ts
247
- git commit -m "fix(610): follower retries on 202 cold-start, never silently closes"
248
- ```
249
-
250
- ---
251
-
252
- ### Task 4: Give-up test — persistent 202 ends with onError + onClose, no fan-out
253
-
254
- **Files:**
255
- - Modify: `maxy-code/platform/ui/app/lib/channel-pty-bridge/__tests__/follower.test.ts`
256
-
257
- - [ ] **Step 1: Write the test**
258
-
259
- Add inside the `describe` block:
260
-
261
- ```ts
262
- it('gives up after the pending window: onError + onClose, no fan-out', async () => {
263
- const stream = makeJsonlStream()
264
- // Every follow fetch returns 202 — the JSONL never appears.
265
- mgr = installManagerFetch({
266
- followStream: stream,
267
- followStatuses: { 'sess-aaaaaaaa': [202] },
268
- })
269
- process.env.CHANNEL_PTY_FOLLOWER_RETRY_MS = '2'
270
- process.env.CHANNEL_PTY_FOLLOWER_PENDING_MAX_MS = '20'
271
- const entry = makeEntry()
272
- const received: string[] = []
273
- entry.subscribers.add((text) => {
274
- received.push(text)
275
- })
276
- const onError = vi.fn()
277
- const onClose = vi.fn()
278
- startFollower({ entry, tag: '[test]', onError, onClose })
279
- await waitFor(() => onClose.mock.calls.length > 0)
280
- expect(onError).toHaveBeenCalledWith('follow-pending-timeout')
281
- expect(onClose).toHaveBeenCalledTimes(1)
282
- expect(received).toEqual([])
283
- })
284
- ```
285
-
286
- - [ ] **Step 2: Run it**
287
-
288
- Run: `cd maxy-code/platform && npx vitest run ui/app/lib/channel-pty-bridge/__tests__/follower.test.ts -t "gives up"`
289
- Expected: PASS — repeated 202s exceed the 20ms window, follower logs `follower-give-up`,
290
- calls `onError('follow-pending-timeout')` and `onClose()` once, no text delivered.
291
-
292
- - [ ] **Step 3: Commit**
293
-
294
- ```bash
295
- git add maxy-code/platform/ui/app/lib/channel-pty-bridge/__tests__/follower.test.ts
296
- git commit -m "test(610): follower gives up after pending window"
297
- ```
298
-
299
- ---
300
-
301
- ### Task 5: Full suite + typecheck + lint
302
-
303
- **Files:** none (verification only)
304
-
305
- - [ ] **Step 1: Run the whole channel-pty-bridge suite**
306
-
307
- Run: `cd maxy-code/platform && npx vitest run ui/app/lib/channel-pty-bridge/__tests__/`
308
- Expected: PASS — all follower tests (6 now), plus dispatch-once, reaper, subscribe,
309
- write-chain, public-session-exit, live-memory-eviction, spawn-refused.
310
-
311
- - [ ] **Step 2: Typecheck the changed files**
312
-
313
- Run: `cd maxy-code/platform && npx tsc --noEmit -p ui/tsconfig.json 2>&1 | grep -E 'follower|helpers' || echo "no type errors in changed files"`
314
- Expected: `no type errors in changed files`.
315
-
316
- - [ ] **Step 3: Lint the changed files**
317
-
318
- Run: `cd maxy-code/platform && npx eslint ui/app/lib/channel-pty-bridge/follower.ts ui/app/lib/channel-pty-bridge/__tests__/follower.test.ts ui/app/lib/channel-pty-bridge/__tests__/helpers.ts`
319
- Expected: no errors.
320
-
321
- ---
322
-
323
- ### Task 6: Documentation — webchat turn lifecycle + new env vars
324
-
325
- **Files:**
326
- - Modify or create: the webchat turn lifecycle reference under `maxy-code/platform/plugins/docs/references/` and the matching internal note under `maxy-code/.docs/` (locate the existing channel-pty-bridge / webchat doc first with a grep; edit it rather than creating a duplicate).
327
-
328
- - [ ] **Step 1: Locate the existing doc**
329
-
330
- Run: `cd maxy-code && grep -rln "channel-pty-bridge\|dispatchOnce\|log-follow-open\|WEBCHAT_TURN_TIMEOUT" .docs/ platform/plugins/docs/references/ 2>/dev/null`
331
- Edit the file(s) that own the webchat turn lifecycle. If none exists, add a short
332
- "Webchat turn lifecycle" section to the most relevant existing reference.
333
-
334
- - [ ] **Step 2: Document the cold-start retry and env vars**
335
-
336
- Add prose covering: the follower opens `GET /:sessionId/log?follow=1`; a cold spawn
337
- returns `202 {pending:true}` until claude flushes its first JSONL line; the follower
338
- retries every `CHANNEL_PTY_FOLLOWER_RETRY_MS` (default 1000) until a 200 stream arrives or
339
- `CHANNEL_PTY_FOLLOWER_PENDING_MAX_MS` (default 120000) elapses, then gives up with
340
- `follower-give-up`. Note the log signature for diagnosis: `follower-connect` →
341
- `follower-retry`* → `follower-open` → `outbound`, mirroring the manager's `log-follow-open`.
342
-
343
- - [ ] **Step 3: Commit**
344
-
345
- ```bash
346
- git add maxy-code/.docs maxy-code/platform/plugins/docs/references
347
- git commit -m "docs(610): webchat follower cold-start retry + env vars"
348
- ```
349
-
350
- ---
351
-
352
- ## Self-Review
353
-
354
- **Spec coverage:**
355
- - Follower retries on 202 → Task 3. ✓
356
- - Env-tunable bound (give-up window + poll interval) → Task 3 Step 1, defaults 120000 / 1000. ✓
357
- - Repro test (202→200, fan-out) → Task 2. ✓
358
- - Give-up test → Task 4. ✓
359
- - Warm-session regression (existing 4 tests unchanged) → Task 1 Step 2, Task 5 Step 1. ✓
360
- - Observability log points (follower-connect / follower-retry / follower-open / follower-give-up) → Task 3 Step 2. ✓
361
- - Manager untouched → no task modifies http-server.ts. ✓
362
- - Docs → Task 6. ✓
363
- - No behaviour change for other channels → no channel-specific code added; covered by shared-follower note in spec. ✓
364
-
365
- **Placeholder scan:** Task 6 requires a grep-locate because the doc's exact path is not yet
366
- known; the content to write is fully specified, only the target file is discovered at
367
- execution. Acceptable — it is not a content placeholder.
368
-
369
- **Type consistency:** `followerPendingMaxMs()` / `followerRetryMs()` used consistently;
370
- `followStatuses` option name matches between helper definition (Task 1) and test use
371
- (Tasks 2, 4); `follow-pending-timeout` error string matches between Task 3 and Task 4
372
- assertion.
@@ -1,230 +0,0 @@
1
- # Public Agent Knowledge Delivery — Implementation Plan
2
-
3
- > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4
-
5
- **Goal:** Make the public agent's `KNOWLEDGE.md` reach its spawn prompt, refuse a dud (empty/missing SOUL or KNOWLEDGE) public spawn with a distinct logged reason, and stop seeding/reading the dead public `SOUL`/`config` templates and `plugins` config field.
6
-
7
- **Architecture:** The only spawn-prompt path is `composeAppendSystemPrompt` in `claude-session-manager`. It reads `agents/<role>/{IDENTITY,SOUL}.md`; we add a public-only `KNOWLEDGE.md` read rendered as `<knowledge>` after `<soul>`, with strict empty/missing refusal. `pty-spawner` maps the new refusal reasons and emits the per-spawn byte-count line. The installer stops manufacturing a public agent on fresh install but re-syncs the Rubytech IDENTITY into existing agent dirs on upgrade. The UI config reader drops the unused `plugins` field. The admin skill doc is corrected to match.
8
-
9
- **Tech Stack:** TypeScript (Node, vitest), bash (`setup-account.sh`), markdown (SKILL.md).
10
-
11
- ---
12
-
13
- ### Task 1: `system-prompt.ts` — read KNOWLEDGE for public, distinct refusal reasons
14
-
15
- **Files:**
16
- - Modify: `services/claude-session-manager/src/system-prompt.ts`
17
- - Test: `services/claude-session-manager/src/__tests__/system-prompt.test.ts`
18
-
19
- **Behaviours:**
20
- - `AppendBlockResult` ok:true gains `knowledgeBytes: number`.
21
- - `AppendBlockResult` ok:false `reason` union gains `'soul-empty' | 'knowledge-missing' | 'knowledge-empty'`.
22
- - `renderAppendBlock` gains a `knowledgeContent: string | null` param; when non-null, render `<knowledge>\n{content}\n</knowledge>` immediately after `</soul>`, before `<about-owner>`; return `knowledgeBytes`. Null ⇒ no block, no bytes (admin + self-test + drift unchanged).
23
- - `composeAppendSystemPrompt`: IDENTITY failure → `identity-unresolved` (all roles, unchanged). SOUL failure → `identity-unresolved` for admin (unchanged); for `role==='public'` → `soul-empty`. When `role==='public'`, read `<roleDir>/KNOWLEDGE.md` via `readIdentityFile`: detail ending `:empty` → `knowledge-empty`; any other failure (ENOENT/unreadable) → `knowledge-missing`. Pass content to `renderAppendBlock`; admin passes `null`.
24
-
25
- - [ ] **Step 1: Write failing tests** — append to `system-prompt.test.ts`:
26
-
27
- ```ts
28
- describe('composeAppendSystemPrompt — public KNOWLEDGE delivery', () => {
29
- function makePublic(seed: { identity?: string | null; soul?: string | null; knowledge?: string | null }): string {
30
- const dir = mkdtempSync(join(tmpdir(), 'task618-account-'))
31
- const roleDir = join(dir, 'agents', 'public')
32
- mkdirSync(roleDir, { recursive: true })
33
- if (typeof seed.identity === 'string') writeFileSync(join(roleDir, 'IDENTITY.md'), seed.identity)
34
- if (typeof seed.soul === 'string') writeFileSync(join(roleDir, 'SOUL.md'), seed.soul)
35
- if (typeof seed.knowledge === 'string') writeFileSync(join(roleDir, 'KNOWLEDGE.md'), seed.knowledge)
36
- return dir
37
- }
38
-
39
- it('public + non-empty KNOWLEDGE ⇒ <knowledge> verbatim, ordered after <soul>, knowledgeBytes>0', () => {
40
- const knowledge = '# Knowledge\nWe open 9-5. Sale price £450k.\n'
41
- const accountDir = makePublic({ identity: 'I', soul: 'S', knowledge })
42
- try {
43
- const result = composeAppendSystemPrompt(HOST, { accountDir, role: 'public' })
44
- expect(result.ok).toBe(true)
45
- if (!result.ok) return
46
- expect(result.block).toContain(`<knowledge>\n${knowledge}\n</knowledge>`)
47
- expect(result.block.indexOf('<knowledge>')).toBeGreaterThan(result.block.indexOf('</soul>'))
48
- expect(result.knowledgeBytes).toBe(Buffer.byteLength(knowledge, 'utf8'))
49
- } finally { rmSync(accountDir, { recursive: true, force: true }) }
50
- })
51
-
52
- it('public + missing KNOWLEDGE ⇒ ok:false reason=knowledge-missing', () => {
53
- const accountDir = makePublic({ identity: 'I', soul: 'S' })
54
- try {
55
- const result = composeAppendSystemPrompt(HOST, { accountDir, role: 'public' })
56
- expect(result.ok).toBe(false)
57
- if (result.ok) return
58
- expect(result.reason).toBe('knowledge-missing')
59
- expect(result.detail).toContain('KNOWLEDGE.md')
60
- } finally { rmSync(accountDir, { recursive: true, force: true }) }
61
- })
62
-
63
- it('public + empty KNOWLEDGE ⇒ ok:false reason=knowledge-empty', () => {
64
- const accountDir = makePublic({ identity: 'I', soul: 'S', knowledge: '' })
65
- try {
66
- const result = composeAppendSystemPrompt(HOST, { accountDir, role: 'public' })
67
- expect(result.ok).toBe(false)
68
- if (result.ok) return
69
- expect(result.reason).toBe('knowledge-empty')
70
- } finally { rmSync(accountDir, { recursive: true, force: true }) }
71
- })
72
-
73
- it('public + empty SOUL ⇒ ok:false reason=soul-empty', () => {
74
- const accountDir = makePublic({ identity: 'I', soul: '', knowledge: 'K' })
75
- try {
76
- const result = composeAppendSystemPrompt(HOST, { accountDir, role: 'public' })
77
- expect(result.ok).toBe(false)
78
- if (result.ok) return
79
- expect(result.reason).toBe('soul-empty')
80
- } finally { rmSync(accountDir, { recursive: true, force: true }) }
81
- })
82
-
83
- it('public + empty IDENTITY ⇒ identity-unresolved (unchanged)', () => {
84
- const accountDir = makePublic({ identity: '', soul: 'S', knowledge: 'K' })
85
- try {
86
- const result = composeAppendSystemPrompt(HOST, { accountDir, role: 'public' })
87
- expect(result.ok).toBe(false)
88
- if (result.ok) return
89
- expect(result.reason).toBe('identity-unresolved')
90
- } finally { rmSync(accountDir, { recursive: true, force: true }) }
91
- })
92
-
93
- it('admin + KNOWLEDGE.md on disk ⇒ no <knowledge> block', () => {
94
- const accountDir = makeAccountDir({ admin: { identity: 'I', soul: 'S' } })
95
- writeFileSync(join(accountDir, 'agents', 'admin', 'KNOWLEDGE.md'), 'admin-knowledge')
96
- try {
97
- const result = composeAppendSystemPrompt(HOST, { accountDir, role: 'admin' })
98
- expect(result.ok).toBe(true)
99
- if (!result.ok) return
100
- expect(result.block).not.toContain('<knowledge>')
101
- expect(result.block).not.toContain('admin-knowledge')
102
- } finally { rmSync(accountDir, { recursive: true, force: true }) }
103
- })
104
-
105
- it('snapshot: full composed public prompt with a sample KNOWLEDGE.md', () => {
106
- const accountDir = makePublic({
107
- identity: '# Identity\nYou speak for the business.',
108
- soul: '# Soul\nWarm, brief.',
109
- knowledge: '# Knowledge\nOpen 9-5. Contact 01234 567890.',
110
- })
111
- try {
112
- const result = composeAppendSystemPrompt(HOST, { accountDir, role: 'public' })
113
- expect(result.ok).toBe(true)
114
- if (!result.ok) return
115
- expect(result.block).toMatchSnapshot()
116
- } finally { rmSync(accountDir, { recursive: true, force: true }) }
117
- })
118
- })
119
- ```
120
-
121
- - [ ] **Step 2: Run, verify fail** — `npx vitest run src/__tests__/system-prompt.test.ts` → FAIL (knowledge not read).
122
-
123
- - [ ] **Step 3: Implement** in `system-prompt.ts`:
124
- - Add `knowledgeBytes: number` to ok:true; extend ok:false reason union.
125
- - Add `knowledgeContent: string | null` param to `renderAppendBlock`; insert `<knowledge>` block after `</soul>` push, before `<about-owner>`; track + return `knowledgeBytes`.
126
- - Update both internal `renderAppendBlock` callers (`runIdentityDriftAssertion`, `runSystemPromptSelfTest`) to pass `null`.
127
- - In `composeAppendSystemPrompt`: on SOUL failure, `return { ok:false, reason: sources.role === 'public' ? 'soul-empty' : 'identity-unresolved', detail: soul.detail }`. When `role==='public'`, read `KNOWLEDGE.md`; on failure `return { ok:false, reason: knowledge.detail.endsWith(':empty') ? 'knowledge-empty' : 'knowledge-missing', detail: knowledge.detail }`. Pass `role==='public' ? knowledge.content : null` to `renderAppendBlock`; set `knowledgeBytes` accordingly (0 for admin).
128
-
129
- - [ ] **Step 4: Run, verify pass** — `npx vitest run src/__tests__/system-prompt.test.ts` → PASS. Review the new snapshot.
130
-
131
- - [ ] **Step 5: Commit** — `feat(public-agent): read KNOWLEDGE.md into public spawn prompt with strict refusal`
132
-
133
- ---
134
-
135
- ### Task 2: `pty-spawner.ts` — surface refusal reasons + per-spawn compose line
136
-
137
- **Files:**
138
- - Modify: `services/claude-session-manager/src/pty-spawner.ts` (`SpawnFailureReason` ~351; compose handling ~1292-1315)
139
-
140
- **Behaviours:**
141
- - `SpawnFailureReason` gains `'soul-empty' | 'knowledge-missing' | 'knowledge-empty'`.
142
- - In the `!composed.ok` branch, for the three new reasons emit `[pty-spawn] spawn-failed reason=<r> role=public slug=<agentSlug>` and return `{ ok:false, reason:<r>, stderrTail: composed.detail }`. The existing `identity-unresolved` path is unchanged.
143
- - Track `knowledge` in `composedBytes`. On public success emit `[pty-spawn] op=public-prompt-compose role=public slug=<agentSlug> identityBytes=N soulBytes=N knowledgeBytes=N` (in addition to the existing `compose-system-prompt-ok` line, which gains `knowledgeBytes`).
144
-
145
- - [ ] **Step 1: Implement** — extend the union; in the failure branch add a `case` for the three reasons before the identity fallthrough; add `knowledge: composed.knowledgeBytes` to `composedBytes`; append `knowledgeBytes=${composed.knowledgeBytes}` to the `compose-system-prompt-ok` log; after that log, `if (args.role === 'public') deps.logger(\`op=public-prompt-compose role=public slug=${agentSlug} identityBytes=${composed.identityBytes} soulBytes=${composed.soulBytes} knowledgeBytes=${composed.knowledgeBytes}\`)`.
146
-
147
- - [ ] **Step 2: Verify** — `npx vitest run` for csm (no test directly asserts these strings; the build + existing suite must stay green). Confirm tsc has no error on the union/result fields.
148
-
149
- - [ ] **Step 3: Commit** — `feat(public-agent): map knowledge/soul refusal reasons + emit public-prompt-compose line`
150
-
151
- ---
152
-
153
- ### Task 3: Templates — delete dead public SOUL + config
154
-
155
- **Files:**
156
- - Delete: `templates/agents/public/SOUL.md`, `templates/agents/public/config.json`
157
- - Keep: `templates/agents/public/IDENTITY.md`
158
-
159
- - [ ] **Step 1:** `git rm templates/agents/public/SOUL.md templates/agents/public/config.json`
160
- - [ ] **Step 2: Verify no live reader** — `grep -rIn 'agents/public/SOUL\|agents/public/config' --include=*.ts --include=*.sh .` returns only `setup-account.sh` lines removed in Task 4. (`smoke-boot-services.sh` and `verify-doc-impl.sh` copy/grep IDENTITY only.)
161
- - [ ] **Step 3: Commit** with Task 4 (template deletion is meaningless without the seed removal).
162
-
163
- ---
164
-
165
- ### Task 4: `setup-account.sh` — no fresh-install public agent; re-sync IDENTITY for existing
166
-
167
- **Files:**
168
- - Modify: `scripts/setup-account.sh` (mkdir ~38; IDENTITY block ~181-184; SOUL/config seed ~221-224)
169
-
170
- **Behaviours:**
171
- - Drop `"$ACCOUNT_DIR/agents/public"` from the line-38 `mkdir -p`.
172
- - Remove the public IDENTITY overwrite (lines 183-184) and the public SOUL/config seed (lines 221-224).
173
- - Add, in the agent-identities section, a loop: for each `"$ACCOUNT_DIR/agents"/*/` whose basename ≠ `admin` and which already contains `IDENTITY.md`, overwrite `IDENTITY.md` from `"$TEMPLATES_DIR/agents/public/IDENTITY.md"`; echo a re-sync line. Never create dirs; never write SOUL/KNOWLEDGE/config. Admin block untouched.
174
-
175
- - [ ] **Step 1: Implement** the three edits.
176
- - [ ] **Step 2: Verify fresh install** — run `setup-account.sh` against a scratch `ACCOUNT_DIR` with no `agents/public`; assert no `agents/public/` is created and `agents/admin/IDENTITY.md` exists.
177
- - [ ] **Step 3: Verify upgrade** — scratch `ACCOUNT_DIR` pre-seeded with `agents/sales/IDENTITY.md` (stale text) + `agents/sales/SOUL.md`; run; assert `agents/sales/IDENTITY.md` now equals the template and `agents/sales/SOUL.md` is untouched.
178
- - [ ] **Step 4: Commit** (with Task 3) — `refactor(installer): public agents author client-side; re-sync IDENTITY for existing dirs only`
179
-
180
- ---
181
-
182
- ### Task 5: `account.ts` — drop the dead `plugins` config field
183
-
184
- **Files:**
185
- - Modify: `ui/app/lib/claude-agent/account.ts` (`ResolvedAgentConfig` ~277; reader ~304,324; return ~395)
186
- - Test: `ui/app/lib/claude-agent/__tests__/spawn-context.test.ts` (trim `plugins` assertions only)
187
-
188
- **Behaviours:**
189
- - Remove `plugins: string[] | null` from `ResolvedAgentConfig`; remove `let plugins`, the `parsed.plugins` read, and `plugins` from the return object. Leave `knowledgeKeywords` and the budget-breakdown `plugins: 0` token field intact.
190
-
191
- - [ ] **Step 1: Find & update the test** — `grep -n 'plugins' ui/app/lib/claude-agent/__tests__/spawn-context.test.ts`; remove only the assertions reading `config.plugins`; add/confirm a case that a public `config.json` lacking `plugins` resolves and `knowledgeKeywords` is still read.
192
- - [ ] **Step 2: Run, verify fail/observe** — `npx vitest run ui/app/lib/claude-agent/__tests__/spawn-context.test.ts`.
193
- - [ ] **Step 3: Implement** the field removal in `account.ts`.
194
- - [ ] **Step 4: Run, verify pass** — same vitest command → PASS.
195
- - [ ] **Step 5: Commit** — `refactor(public-agent): drop unused plugins field from resolved agent config`
196
-
197
- ---
198
-
199
- ### Task 6: `public-agent-manager/SKILL.md` — correct the doc
200
-
201
- **Files:**
202
- - Modify: `plugins/admin/skills/public-agent-manager/SKILL.md`
203
-
204
- **Behaviours (scope item 6):**
205
- - (a) Table: `KNOWLEDGE.md` Required → Yes; `SOUL.md` purpose → personality + role (basic public info, capture the visitor's contact details for human follow-up — the chat equivalent of the landing-page contact form). Add a line: SOUL.md and KNOWLEDGE.md are authored entirely client-side and must be non-empty before the agent goes active; an empty one is refused at spawn. KNOWLEDGE = the business's public-facing facts at landing-page detail.
206
- - (b) Create step: IDENTITY.md is copied from the Rubytech template verbatim, not drafted/edited.
207
- - (c) Remove the `plugins` key from the `config.json` example; remove "selected plugins" from the table; delete the "Plugin Selection" section; remove the plugin-selection Create step and renumber the Create steps + every cross-reference (`Step 4/5/6/7`, `All other steps (4, 8-12)`). Update the template-create plugin pre-select bullet (plugins gone) and note IDENTITY is the fixed Rubytech template.
208
- - (d) Ensure no reference to a SOUL/config seed template remains.
209
- - Keep: `knowledgeKeywords` field, the create-form field, keyword-subscription and direct-tagging sections, projection steps.
210
-
211
- - [ ] **Step 1: Implement** the edits above.
212
- - [ ] **Step 2: Verify** — `grep -n 'plugins' SKILL.md` shows no `plugins` config key or Plugin Selection section (knowledgeKeywords/tagging prose may remain); Create steps are sequentially numbered with consistent cross-refs.
213
- - [ ] **Step 3: Commit** — `docs(public-agent): KNOWLEDGE required, IDENTITY templated, drop plugins from skill`
214
-
215
- ---
216
-
217
- ### Task 7: Verify — build, bundle, full suites
218
-
219
- - [ ] **Step 1:** `npm run build:claude-session-manager` → no tsc errors.
220
- - [ ] **Step 2:** Full csm suite `cd services/claude-session-manager && npx vitest run` → green (esp. `public-identity-template`, `pty-spawner-channels`).
221
- - [ ] **Step 3:** `npx vitest run ui/app/lib/claude-agent/__tests__/` → green.
222
- - [ ] **Step 4:** Bundle the installer payload (`maxy-code/packages/create-maxy-code` `npm run bundle`) → no runtime errors; confirm `templates/agents/public/` in the payload contains only `IDENTITY.md`.
223
-
224
- ---
225
-
226
- ## Self-Review
227
-
228
- - **Spec coverage:** scope 1→T1, 2→T2, 3→T3, 4→T4, 5→T5, 6→T6; verification + observability→T1/T2/T7. All covered.
229
- - **Out of scope (untouched):** `knowledgeKeywords` machinery, projection routes, the migrated Real Agent agent's KNOWLEDGE authoring, Pi hand-patched files.
230
- - **Type consistency:** `knowledgeBytes` and the three reasons named identically in T1 (composer) and T2 (spawner). `renderAppendBlock` `knowledgeContent` param threaded through all three callers.