@rubytech/create-maxy-code 0.1.244 → 0.1.246

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 (36) hide show
  1. package/package.json +1 -1
  2. package/payload/platform/docs/superpowers/plans/2026-06-04-public-agent-knowledge-delivery.md +230 -0
  3. package/payload/platform/plugins/admin/mcp/dist/index.js +1 -1
  4. package/payload/platform/plugins/admin/mcp/dist/index.js.map +1 -1
  5. package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +16 -16
  6. package/payload/platform/plugins/admin/skills/public-agent-manager/SKILL.md +32 -56
  7. package/payload/platform/plugins/cloudflare/.claude-plugin/plugin.json +1 -1
  8. package/payload/platform/plugins/cloudflare/PLUGIN.md +10 -7
  9. package/payload/platform/plugins/cloudflare/references/api.md +166 -0
  10. package/payload/platform/plugins/cloudflare/references/d1-data-capture.md +157 -0
  11. package/payload/platform/plugins/cloudflare/references/dashboard-guide.md +6 -6
  12. package/payload/platform/plugins/cloudflare/references/hosting-sites.md +66 -0
  13. package/payload/platform/plugins/cloudflare/references/manual-setup.md +5 -3
  14. package/payload/platform/plugins/cloudflare/skills/cloudflare/SKILL.md +72 -0
  15. package/payload/platform/plugins/docs/references/cloudflare.md +4 -4
  16. package/payload/platform/plugins/docs/references/deployment.md +1 -1
  17. package/payload/platform/scripts/setup-account.sh +16 -8
  18. package/payload/platform/services/claude-session-manager/dist/jsonl-tail.d.ts +12 -0
  19. package/payload/platform/services/claude-session-manager/dist/jsonl-tail.d.ts.map +1 -1
  20. package/payload/platform/services/claude-session-manager/dist/jsonl-tail.js +1 -1
  21. package/payload/platform/services/claude-session-manager/dist/jsonl-tail.js.map +1 -1
  22. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts +1 -1
  23. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
  24. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +31 -5
  25. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
  26. package/payload/platform/services/claude-session-manager/dist/system-prompt.d.ts +2 -1
  27. package/payload/platform/services/claude-session-manager/dist/system-prompt.d.ts.map +1 -1
  28. package/payload/platform/services/claude-session-manager/dist/system-prompt.js +39 -6
  29. package/payload/platform/services/claude-session-manager/dist/system-prompt.js.map +1 -1
  30. package/payload/platform/templates/specialists/agents/personal-assistant.md +2 -2
  31. package/payload/server/{chunk-SRO5RFMV.js → chunk-JMEX5NRX.js} +1 -3
  32. package/payload/server/maxy-edge.js +1 -1
  33. package/payload/server/server.js +1 -1
  34. package/payload/platform/plugins/cloudflare/skills/setup-tunnel/SKILL.md +0 -55
  35. package/payload/platform/templates/agents/public/SOUL.md +0 -19
  36. package/payload/platform/templates/agents/public/config.json +0 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rubytech/create-maxy-code",
3
- "version": "0.1.244",
3
+ "version": "0.1.246",
4
4
  "description": "Install Maxy — AI for Productive People",
5
5
  "bin": {
6
6
  "create-maxy-code": "./dist/index.js"
@@ -0,0 +1,230 @@
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.
@@ -499,7 +499,7 @@ eagerTool(server, "public-hostname", "Resolve this account's canonical public ho
499
499
  content: [{
500
500
  type: "text",
501
501
  text: `hostname: (none)\nreason: ${result.reason}\n` +
502
- `No Cloudflare tunnel is configured for this account. Run the cloudflare setup-tunnel skill before publishing externally.`,
502
+ `No Cloudflare tunnel is configured for this account. Run the cloudflare skill before publishing externally.`,
503
503
  }],
504
504
  };
505
505
  }