myaiforone 1.0.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 (315) hide show
  1. package/README.md +113 -0
  2. package/agents/_template/CLAUDE.md +18 -0
  3. package/agents/_template/agent.json +7 -0
  4. package/agents/platform/agentcreator/CLAUDE.md +300 -0
  5. package/agents/platform/appcreator/CLAUDE.md +158 -0
  6. package/agents/platform/gym/CLAUDE.md +486 -0
  7. package/agents/platform/gym/agent.json +40 -0
  8. package/agents/platform/gym/programs/agent-building/program.json +160 -0
  9. package/agents/platform/gym/programs/automations-mastery/program.json +129 -0
  10. package/agents/platform/gym/programs/getting-started/program.json +124 -0
  11. package/agents/platform/gym/programs/mcp-integrations/program.json +116 -0
  12. package/agents/platform/gym/programs/multi-model-strategy/program.json +115 -0
  13. package/agents/platform/gym/programs/prompt-engineering/program.json +136 -0
  14. package/agents/platform/gym/souls/alex.md +12 -0
  15. package/agents/platform/gym/souls/jordan.md +12 -0
  16. package/agents/platform/gym/souls/morgan.md +12 -0
  17. package/agents/platform/gym/souls/riley.md +12 -0
  18. package/agents/platform/gym/souls/sam.md +12 -0
  19. package/agents/platform/hub/CLAUDE.md +372 -0
  20. package/agents/platform/promptcreator/CLAUDE.md +130 -0
  21. package/agents/platform/skillcreator/CLAUDE.md +163 -0
  22. package/bin/cli.js +566 -0
  23. package/config.example.json +310 -0
  24. package/dist/agent-registry.d.ts +32 -0
  25. package/dist/agent-registry.d.ts.map +1 -0
  26. package/dist/agent-registry.js +144 -0
  27. package/dist/agent-registry.js.map +1 -0
  28. package/dist/channels/discord.d.ts +17 -0
  29. package/dist/channels/discord.d.ts.map +1 -0
  30. package/dist/channels/discord.js +114 -0
  31. package/dist/channels/discord.js.map +1 -0
  32. package/dist/channels/imessage.d.ts +23 -0
  33. package/dist/channels/imessage.d.ts.map +1 -0
  34. package/dist/channels/imessage.js +214 -0
  35. package/dist/channels/imessage.js.map +1 -0
  36. package/dist/channels/slack.d.ts +19 -0
  37. package/dist/channels/slack.d.ts.map +1 -0
  38. package/dist/channels/slack.js +167 -0
  39. package/dist/channels/slack.js.map +1 -0
  40. package/dist/channels/telegram.d.ts +19 -0
  41. package/dist/channels/telegram.d.ts.map +1 -0
  42. package/dist/channels/telegram.js +274 -0
  43. package/dist/channels/telegram.js.map +1 -0
  44. package/dist/channels/types.d.ts +44 -0
  45. package/dist/channels/types.d.ts.map +1 -0
  46. package/dist/channels/types.js +18 -0
  47. package/dist/channels/types.js.map +1 -0
  48. package/dist/channels/whatsapp.d.ts +23 -0
  49. package/dist/channels/whatsapp.d.ts.map +1 -0
  50. package/dist/channels/whatsapp.js +189 -0
  51. package/dist/channels/whatsapp.js.map +1 -0
  52. package/dist/config.d.ts +134 -0
  53. package/dist/config.d.ts.map +1 -0
  54. package/dist/config.js +127 -0
  55. package/dist/config.js.map +1 -0
  56. package/dist/cron.d.ts +8 -0
  57. package/dist/cron.d.ts.map +1 -0
  58. package/dist/cron.js +35 -0
  59. package/dist/cron.js.map +1 -0
  60. package/dist/decrypt-keys.d.ts +7 -0
  61. package/dist/decrypt-keys.d.ts.map +1 -0
  62. package/dist/decrypt-keys.js +53 -0
  63. package/dist/decrypt-keys.js.map +1 -0
  64. package/dist/encrypt-keys.d.ts +8 -0
  65. package/dist/encrypt-keys.d.ts.map +1 -0
  66. package/dist/encrypt-keys.js +62 -0
  67. package/dist/encrypt-keys.js.map +1 -0
  68. package/dist/executor.d.ts +31 -0
  69. package/dist/executor.d.ts.map +1 -0
  70. package/dist/executor.js +2009 -0
  71. package/dist/executor.js.map +1 -0
  72. package/dist/gemini-executor.d.ts +27 -0
  73. package/dist/gemini-executor.d.ts.map +1 -0
  74. package/dist/gemini-executor.js +160 -0
  75. package/dist/gemini-executor.js.map +1 -0
  76. package/dist/goals.d.ts +24 -0
  77. package/dist/goals.d.ts.map +1 -0
  78. package/dist/goals.js +189 -0
  79. package/dist/goals.js.map +1 -0
  80. package/dist/gym/activity-digest.d.ts +30 -0
  81. package/dist/gym/activity-digest.d.ts.map +1 -0
  82. package/dist/gym/activity-digest.js +506 -0
  83. package/dist/gym/activity-digest.js.map +1 -0
  84. package/dist/gym/dimension-scorer.d.ts +76 -0
  85. package/dist/gym/dimension-scorer.d.ts.map +1 -0
  86. package/dist/gym/dimension-scorer.js +236 -0
  87. package/dist/gym/dimension-scorer.js.map +1 -0
  88. package/dist/gym/gym-router.d.ts +7 -0
  89. package/dist/gym/gym-router.d.ts.map +1 -0
  90. package/dist/gym/gym-router.js +718 -0
  91. package/dist/gym/gym-router.js.map +1 -0
  92. package/dist/gym/index.d.ts +11 -0
  93. package/dist/gym/index.d.ts.map +1 -0
  94. package/dist/gym/index.js +11 -0
  95. package/dist/gym/index.js.map +1 -0
  96. package/dist/heartbeat.d.ts +21 -0
  97. package/dist/heartbeat.d.ts.map +1 -0
  98. package/dist/heartbeat.js +163 -0
  99. package/dist/heartbeat.js.map +1 -0
  100. package/dist/index.d.ts +2 -0
  101. package/dist/index.d.ts.map +1 -0
  102. package/dist/index.js +254 -0
  103. package/dist/index.js.map +1 -0
  104. package/dist/keystore.d.ts +22 -0
  105. package/dist/keystore.d.ts.map +1 -0
  106. package/dist/keystore.js +178 -0
  107. package/dist/keystore.js.map +1 -0
  108. package/dist/logger.d.ts +9 -0
  109. package/dist/logger.d.ts.map +1 -0
  110. package/dist/logger.js +45 -0
  111. package/dist/logger.js.map +1 -0
  112. package/dist/memory/daily.d.ts +22 -0
  113. package/dist/memory/daily.d.ts.map +1 -0
  114. package/dist/memory/daily.js +82 -0
  115. package/dist/memory/daily.js.map +1 -0
  116. package/dist/memory/embeddings.d.ts +15 -0
  117. package/dist/memory/embeddings.d.ts.map +1 -0
  118. package/dist/memory/embeddings.js +154 -0
  119. package/dist/memory/embeddings.js.map +1 -0
  120. package/dist/memory/index.d.ts +32 -0
  121. package/dist/memory/index.d.ts.map +1 -0
  122. package/dist/memory/index.js +159 -0
  123. package/dist/memory/index.js.map +1 -0
  124. package/dist/memory/search.d.ts +21 -0
  125. package/dist/memory/search.d.ts.map +1 -0
  126. package/dist/memory/search.js +77 -0
  127. package/dist/memory/search.js.map +1 -0
  128. package/dist/memory/store.d.ts +23 -0
  129. package/dist/memory/store.d.ts.map +1 -0
  130. package/dist/memory/store.js +144 -0
  131. package/dist/memory/store.js.map +1 -0
  132. package/dist/ollama-executor.d.ts +17 -0
  133. package/dist/ollama-executor.d.ts.map +1 -0
  134. package/dist/ollama-executor.js +112 -0
  135. package/dist/ollama-executor.js.map +1 -0
  136. package/dist/openai-executor.d.ts +38 -0
  137. package/dist/openai-executor.d.ts.map +1 -0
  138. package/dist/openai-executor.js +197 -0
  139. package/dist/openai-executor.js.map +1 -0
  140. package/dist/router.d.ts +11 -0
  141. package/dist/router.d.ts.map +1 -0
  142. package/dist/router.js +185 -0
  143. package/dist/router.js.map +1 -0
  144. package/dist/test-message.d.ts +2 -0
  145. package/dist/test-message.d.ts.map +1 -0
  146. package/dist/test-message.js +60 -0
  147. package/dist/test-message.js.map +1 -0
  148. package/dist/utils/imsg-db-reader.d.ts +24 -0
  149. package/dist/utils/imsg-db-reader.d.ts.map +1 -0
  150. package/dist/utils/imsg-db-reader.js +92 -0
  151. package/dist/utils/imsg-db-reader.js.map +1 -0
  152. package/dist/utils/imsg-rpc.d.ts +25 -0
  153. package/dist/utils/imsg-rpc.d.ts.map +1 -0
  154. package/dist/utils/imsg-rpc.js +149 -0
  155. package/dist/utils/imsg-rpc.js.map +1 -0
  156. package/dist/utils/message-formatter.d.ts +3 -0
  157. package/dist/utils/message-formatter.d.ts.map +1 -0
  158. package/dist/utils/message-formatter.js +69 -0
  159. package/dist/utils/message-formatter.js.map +1 -0
  160. package/dist/web-ui.d.ts +12 -0
  161. package/dist/web-ui.d.ts.map +1 -0
  162. package/dist/web-ui.js +5784 -0
  163. package/dist/web-ui.js.map +1 -0
  164. package/dist/whatsapp-chats.d.ts +2 -0
  165. package/dist/whatsapp-chats.d.ts.map +1 -0
  166. package/dist/whatsapp-chats.js +76 -0
  167. package/dist/whatsapp-chats.js.map +1 -0
  168. package/dist/whatsapp-login.d.ts +2 -0
  169. package/dist/whatsapp-login.d.ts.map +1 -0
  170. package/dist/whatsapp-login.js +90 -0
  171. package/dist/whatsapp-login.js.map +1 -0
  172. package/dist/wiki-sync.d.ts +21 -0
  173. package/dist/wiki-sync.d.ts.map +1 -0
  174. package/dist/wiki-sync.js +147 -0
  175. package/dist/wiki-sync.js.map +1 -0
  176. package/docs/AddNewAgentGuide.md +100 -0
  177. package/docs/AddNewMcpGuide.md +72 -0
  178. package/docs/Architecture.md +795 -0
  179. package/docs/CLAUDE-AI-SETUP.md +166 -0
  180. package/docs/Setup.md +297 -0
  181. package/docs/ai-gym-architecture.md +1040 -0
  182. package/docs/ai-gym-build-plan.md +343 -0
  183. package/docs/ai-gym-onboarding.md +122 -0
  184. package/docs/appcreator_plan.md +348 -0
  185. package/docs/platform-mcp-audit.md +320 -0
  186. package/docs/server-deployment-plan.md +503 -0
  187. package/docs/superpowers/plans/2026-03-25-marketplace.md +1281 -0
  188. package/docs/superpowers/specs/2026-03-25-marketplace-design.md +287 -0
  189. package/docs/user-guide.md +2016 -0
  190. package/mcp-catalog.json +628 -0
  191. package/package.json +63 -0
  192. package/public/MyAIforOne-logomark-512.svg +16 -0
  193. package/public/MyAIforOne-logomark-transparent.svg +15 -0
  194. package/public/activity.html +314 -0
  195. package/public/admin.html +1674 -0
  196. package/public/agent-dashboard.html +670 -0
  197. package/public/api-docs.html +1106 -0
  198. package/public/automations.html +722 -0
  199. package/public/canvas.css +223 -0
  200. package/public/canvas.js +588 -0
  201. package/public/changelog.html +231 -0
  202. package/public/gym.html +2766 -0
  203. package/public/home.html +1930 -0
  204. package/public/index.html +2809 -0
  205. package/public/lab.html +1643 -0
  206. package/public/library.html +1442 -0
  207. package/public/marketplace.html +1101 -0
  208. package/public/mcp-docs.html +441 -0
  209. package/public/mini.html +390 -0
  210. package/public/monitor.html +584 -0
  211. package/public/org.html +4304 -0
  212. package/public/projects.html +734 -0
  213. package/public/settings.html +645 -0
  214. package/public/tasks.html +932 -0
  215. package/public/trainers/alex.svg +12 -0
  216. package/public/trainers/jordan.svg +12 -0
  217. package/public/trainers/morgan.svg +12 -0
  218. package/public/trainers/riley.svg +12 -0
  219. package/public/trainers/sam.svg +12 -0
  220. package/public/user-guide.html +218 -0
  221. package/registry/agents.json +3 -0
  222. package/registry/apps.json +20 -0
  223. package/registry/installed-drafts.json +3 -0
  224. package/registry/mcps.json +1084 -0
  225. package/registry/prompts/personal/mcp-test-prompt.md +6 -0
  226. package/registry/prompts/personal/memory-recall.md +6 -0
  227. package/registry/prompts/platform/brainstorm.md +15 -0
  228. package/registry/prompts/platform/code-review.md +16 -0
  229. package/registry/prompts/platform/explain.md +16 -0
  230. package/registry/prompts.json +58 -0
  231. package/registry/skills/external/brainstorming.md +5 -0
  232. package/registry/skills/external/code-review.md +40 -0
  233. package/registry/skills/external/frontend-patterns.md +642 -0
  234. package/registry/skills/external/frontend-slides.md +184 -0
  235. package/registry/skills/external/systematic-debugging.md +5 -0
  236. package/registry/skills/external/tdd.md +328 -0
  237. package/registry/skills/external/verification-before-completion.md +5 -0
  238. package/registry/skills/external/writing-plans.md +5 -0
  239. package/registry/skills/platform/ai41_app_build.md +930 -0
  240. package/registry/skills/platform/ai41_app_deploy.md +168 -0
  241. package/registry/skills/platform/ai41_app_orchestrator.md +239 -0
  242. package/registry/skills/platform/ai41_app_patterns.md +359 -0
  243. package/registry/skills/platform/ai41_app_register.md +85 -0
  244. package/registry/skills/platform/ai41_app_scaffold.md +421 -0
  245. package/registry/skills/platform/ai41_app_verify.md +107 -0
  246. package/registry/skills/platform/opProjectCreate.md +239 -0
  247. package/registry/skills/platform/op_devbrowser.md +136 -0
  248. package/registry/skills/platform/sop_brandguidelines.md +103 -0
  249. package/registry/skills/platform/sop_docx.md +117 -0
  250. package/registry/skills/platform/sop_frontenddesign.md +44 -0
  251. package/registry/skills/platform/sop_frontenddesign_v2.md +659 -0
  252. package/registry/skills/platform/sop_mcpbuilder.md +133 -0
  253. package/registry/skills/platform/sop_pdf.md +172 -0
  254. package/registry/skills/platform/sop_pptx.md +133 -0
  255. package/registry/skills/platform/sop_skillcreator.md +104 -0
  256. package/registry/skills/platform/sop_themefactory.md +128 -0
  257. package/registry/skills/platform/sop_webapptesting.md +75 -0
  258. package/registry/skills/platform/sop_webartifactsbuilder.md +97 -0
  259. package/registry/skills/platform/sop_xlsx.md +134 -0
  260. package/registry/skills.json +1055 -0
  261. package/scripts/discover-chats.sh +11 -0
  262. package/scripts/install-service-windows.ps1 +87 -0
  263. package/scripts/install-service.sh +52 -0
  264. package/scripts/seed-registry.ts +195 -0
  265. package/scripts/test-send.sh +5 -0
  266. package/scripts/tray-indicator.ps1 +35 -0
  267. package/scripts/uninstall-service-windows.ps1 +23 -0
  268. package/scripts/uninstall-service.sh +15 -0
  269. package/scripts/xbar-myagent.5s.sh +32 -0
  270. package/server/mcp-server/dist/index.d.ts +11 -0
  271. package/server/mcp-server/dist/index.js +1332 -0
  272. package/server/mcp-server/dist/lib/api-client.d.ts +165 -0
  273. package/server/mcp-server/dist/lib/api-client.js +241 -0
  274. package/server/mcp-server/index.ts +1545 -0
  275. package/server/mcp-server/lib/api-client.ts +366 -0
  276. package/server/mcp-server/tsconfig.json +14 -0
  277. package/src/agent-registry.ts +180 -0
  278. package/src/channels/discord.ts +129 -0
  279. package/src/channels/imessage.ts +261 -0
  280. package/src/channels/slack.ts +208 -0
  281. package/src/channels/telegram.ts +307 -0
  282. package/src/channels/types.ts +62 -0
  283. package/src/channels/whatsapp.ts +227 -0
  284. package/src/config.ts +281 -0
  285. package/src/cron.ts +43 -0
  286. package/src/decrypt-keys.ts +60 -0
  287. package/src/encrypt-keys.ts +70 -0
  288. package/src/executor.ts +2190 -0
  289. package/src/gemini-executor.ts +212 -0
  290. package/src/goals.ts +240 -0
  291. package/src/gym/activity-digest.ts +546 -0
  292. package/src/gym/dimension-scorer.ts +297 -0
  293. package/src/gym/gym-router.ts +801 -0
  294. package/src/gym/index.ts +19 -0
  295. package/src/heartbeat.ts +220 -0
  296. package/src/index.ts +275 -0
  297. package/src/keystore.ts +190 -0
  298. package/src/logger.ts +51 -0
  299. package/src/memory/daily.ts +101 -0
  300. package/src/memory/embeddings.ts +185 -0
  301. package/src/memory/index.ts +218 -0
  302. package/src/memory/search.ts +124 -0
  303. package/src/memory/store.ts +189 -0
  304. package/src/ollama-executor.ts +126 -0
  305. package/src/openai-executor.ts +259 -0
  306. package/src/router.ts +230 -0
  307. package/src/test-message.ts +72 -0
  308. package/src/utils/imsg-db-reader.ts +109 -0
  309. package/src/utils/imsg-rpc.ts +178 -0
  310. package/src/utils/message-formatter.ts +90 -0
  311. package/src/web-ui.ts +5778 -0
  312. package/src/whatsapp-chats.ts +91 -0
  313. package/src/whatsapp-login.ts +110 -0
  314. package/src/wiki-sync.ts +199 -0
  315. package/tsconfig.json +19 -0
@@ -0,0 +1,168 @@
1
+ ---
2
+ name: ai41_app_deploy
3
+ description: >-
4
+ Deploy a full-stack app to Railway via CLI. Handles git init, GitHub repo creation, Railway project setup, database provisioning, and health verification. Called by ai41_app_orchestrator Phase 6.
5
+ allowed-tools: Bash Read Edit
6
+ ---
7
+
8
+ # App Deploy
9
+
10
+ Deploy the built app to Railway. This skill handles the full pipeline from local code to live URL.
11
+
12
+ ## Prerequisites
13
+ - App has passed all verify checks (ai41_app_verify)
14
+ - Railway CLI is installed (`railway` command available)
15
+ - GitHub CLI is installed (`gh` command available)
16
+ - User has confirmed they want to deploy
17
+
18
+ ## Step 1: Git Initialize
19
+
20
+ ```bash
21
+ cd {APP_DIR}
22
+ git init
23
+ git add -A
24
+ git commit -m "Initial commit: {APP_NAME}"
25
+ ```
26
+
27
+ If git is already initialized, just add and commit:
28
+ ```bash
29
+ cd {APP_DIR}
30
+ git add -A
31
+ git commit -m "Initial commit: {APP_NAME}" --allow-empty
32
+ ```
33
+
34
+ ## Step 2: Create GitHub Repository
35
+
36
+ ```bash
37
+ gh repo create agenticledger/{APP_SLUG} --private --source=. --push
38
+ ```
39
+
40
+ **If `agenticledger` org fails:** try without org:
41
+ ```bash
42
+ gh repo create {APP_SLUG} --private --source=. --push
43
+ ```
44
+
45
+ Capture the repo URL for later use.
46
+
47
+ **If repo already exists:** just push:
48
+ ```bash
49
+ git remote add origin https://github.com/agenticledger/{APP_SLUG}.git 2>/dev/null || true
50
+ git push -u origin main
51
+ ```
52
+
53
+ ## Step 3: Create Railway Project
54
+
55
+ ```bash
56
+ cd {APP_DIR}
57
+ railway init --name {APP_SLUG}
58
+ ```
59
+
60
+ This creates a new Railway project. Note the project ID.
61
+
62
+ ## Step 4: Provision Database (if needed)
63
+
64
+ ```bash
65
+ railway add --database postgres
66
+ ```
67
+
68
+ This creates a PostgreSQL service in the Railway project. Railway automatically provides `DATABASE_URL` to linked services.
69
+
70
+ ## Step 5: Deploy Backend
71
+
72
+ ```bash
73
+ cd {APP_DIR}/backend
74
+ railway up --detach
75
+ ```
76
+
77
+ Set environment variables:
78
+ ```bash
79
+ railway variables set PORT=3001 NODE_ENV=production
80
+ ```
81
+
82
+ If the app uses a database, Railway auto-injects `DATABASE_URL` from the Postgres service.
83
+
84
+ Wait for deployment to start, then check status:
85
+ ```bash
86
+ railway status
87
+ ```
88
+
89
+ ## Step 6: Deploy Frontend
90
+
91
+ For the frontend, we need to build it and serve it. Two approaches:
92
+
93
+ **Option A: Deploy frontend as a separate Railway service**
94
+ ```bash
95
+ cd {APP_DIR}/frontend
96
+ railway service create {APP_SLUG}-frontend
97
+ railway up --detach
98
+ ```
99
+
100
+ **Option B: Serve frontend from backend (recommended for simplicity)**
101
+ Before deploying, modify `backend/src/index.ts` to serve the built frontend:
102
+
103
+ 1. Build frontend: `cd {APP_DIR}/frontend && npm run build`
104
+ 2. Copy dist to backend: `cp -r {APP_DIR}/frontend/dist {APP_DIR}/backend/public`
105
+ 3. Add static serving to Express:
106
+ ```typescript
107
+ // After routes, before error handler:
108
+ app.use(express.static("public"));
109
+ app.get("*", (_req, res) => {
110
+ res.sendFile("index.html", { root: "public" });
111
+ });
112
+ ```
113
+ 4. Update backend's package.json build script to include frontend build
114
+ 5. Redeploy backend
115
+
116
+ ## Step 7: Generate Domain
117
+
118
+ ```bash
119
+ railway domain
120
+ ```
121
+
122
+ This generates a public URL like `https://{app-slug}.up.railway.app`.
123
+
124
+ Capture this URL — it's what the user gets.
125
+
126
+ ## Step 8: Verify Deployment
127
+
128
+ ```bash
129
+ curl -s https://{RAILWAY_URL}/api/health | head -20
130
+ ```
131
+
132
+ Should return `{"status":"ok","timestamp":"..."}`.
133
+
134
+ **If health check fails:**
135
+ 1. Check Railway logs:
136
+ ```bash
137
+ railway logs --tail 50
138
+ ```
139
+ 2. Read the error
140
+ 3. Common issues:
141
+ - Missing env vars → `railway variables set KEY=VALUE`
142
+ - Port binding → ensure backend uses `process.env.PORT`
143
+ - Database connection → check `DATABASE_URL` is set
144
+ - Build failure → check the build output in Railway dashboard
145
+ 4. Fix the code locally, commit, push, Railway auto-redeploys
146
+ 5. Wait and check again (max 3 retries)
147
+
148
+ ## Step 9: Run Prisma Migrations on Railway (if database)
149
+
150
+ After deployment is healthy:
151
+ ```bash
152
+ cd {APP_DIR}/backend
153
+ railway run npx prisma db push
154
+ ```
155
+
156
+ Or if using migrations:
157
+ ```bash
158
+ railway run npx prisma migrate deploy
159
+ ```
160
+
161
+ ## Output
162
+
163
+ When deployment is verified healthy, report:
164
+ - `deployUrl`: the Railway public URL
165
+ - `githubRepo`: the GitHub repo URL
166
+ - `railwayProject`: the Railway project name
167
+
168
+ Return to orchestrator for Phase 7 (Register).
@@ -0,0 +1,239 @@
1
+ ---
2
+ name: ai41_app_orchestrator
3
+ description: >-
4
+ Master orchestration runbook for building full-stack apps autonomously. Coordinates scaffold, build, verify, deploy, and register phases. Use when a user asks to build or create an app.
5
+ allowed-tools: Read Bash
6
+ ---
7
+
8
+ # App Build Orchestrator
9
+
10
+ You are building a full-stack web application autonomously. Follow these phases IN ORDER. Do not skip phases. Check every exit criterion before advancing.
11
+
12
+ ## Before Starting
13
+
14
+ 1. Read the user's request carefully. Identify:
15
+ - App name (derive a slug like `expense-tracker`)
16
+ - Core features requested
17
+ - Whether it needs a database (most apps do — default YES)
18
+ - Whether it needs auth (look for mentions of users, login, accounts)
19
+ - Whether it needs any sub-patterns (see Sub-Skill Selection below)
20
+ 2. Confirm the plan with the user in 2-3 sentences: "I'll build {name} with {features}. Tech stack: Express 5 + React 19 + Prisma + PostgreSQL + Tailwind + shadcn/ui."
21
+ 3. Then go silent and execute.
22
+
23
+ ## Sub-Skill Selection
24
+
25
+ Based on the user's request, determine which sub-skills to apply DURING the Build phase:
26
+
27
+ | If user mentions... | Apply sub-skill |
28
+ |---------------------|----------------|
29
+ | login, users, accounts, auth | `ai41_app_pattern_auth` |
30
+ | orgs, tenants, teams, multi-tenant | `ai41_app_pattern_multitenant` |
31
+ | AI, chat, embeddings, agent | `ai41_app_pattern_ai_agent` |
32
+ | billing, payments, subscriptions | `ai41_app_pattern_payments` |
33
+ | charts, analytics, dashboard | `ai41_app_pattern_dashboard` |
34
+ | real-time, live updates, websocket | `ai41_app_pattern_realtime` |
35
+ | file upload, documents, images | `ai41_app_pattern_file_upload` |
36
+ | email, notifications | `ai41_app_pattern_email` |
37
+
38
+ If a sub-skill doesn't exist yet, apply the pattern using your best judgment based on the conventions in `ai41_app_patterns`.
39
+
40
+ ---
41
+
42
+ ## Phase 1: SCAFFOLD
43
+
44
+ ### Entry Criteria
45
+ - User has described what they want
46
+ - You've confirmed the plan
47
+
48
+ ### Actions
49
+ 1. Read the `ai41_app_scaffold` skill
50
+ 2. Follow it exactly — it creates the project directory and all config files deterministically
51
+ 3. The workspace is `{PROJECT_DIR}/`
52
+
53
+ ### Exit Checklist
54
+ - [ ] Directory `{PROJECT_DIR}/` exists
55
+ - [ ] `backend/package.json` exists with correct dependencies
56
+ - [ ] `frontend/package.json` exists with correct dependencies
57
+ - [ ] `backend/node_modules/` exists (npm install succeeded)
58
+ - [ ] `frontend/node_modules/` exists (npm install succeeded)
59
+ - [ ] `backend/prisma/schema.prisma` exists
60
+ - [ ] `backend/src/index.ts` exists
61
+ - [ ] `frontend/src/App.tsx` exists
62
+ - [ ] `.gitignore` exists at project root
63
+
64
+ ### Max Retries: 2
65
+ ### On Failure: Report to user — scaffold failed, likely a network issue with npm install.
66
+
67
+ ---
68
+
69
+ ## Phase 2: PLAN
70
+
71
+ ### Entry Criteria
72
+ - Scaffold complete, all config files in place
73
+
74
+ ### Actions
75
+ 1. Analyze the user's request and produce a plan:
76
+ - Database schema (Prisma models needed)
77
+ - API routes (Express endpoints)
78
+ - Frontend pages and components
79
+ - Auth approach (if needed)
80
+ 2. Output the plan to the user as a numbered list (10 points max)
81
+ 3. Do NOT wait for approval — immediately proceed to Build
82
+
83
+ ### Exit Checklist
84
+ - [ ] Plan outputted to chat
85
+ - [ ] You know what Prisma models to create
86
+ - [ ] You know what API routes to create
87
+ - [ ] You know what React pages/components to create
88
+
89
+ ---
90
+
91
+ ## Phase 3: BUILD
92
+
93
+ ### Entry Criteria
94
+ - Plan complete
95
+
96
+ ### Actions
97
+ 1. Read the `ai41_app_patterns` skill for YOUR architecture conventions
98
+ 2. Read any relevant sub-skills identified in Sub-Skill Selection
99
+ 3. Write all application code:
100
+
101
+ **Backend (in order):**
102
+ a. `prisma/schema.prisma` — add models
103
+ b. `src/routes/` — create route files (one per domain)
104
+ c. `src/middleware/` — auth, error handler, validation
105
+ d. `src/index.ts` — register all routes
106
+ e. `prisma/seed.ts` — seed data (if applicable)
107
+
108
+ **Frontend (in order):**
109
+ a. `src/components/ui/` — shadcn/ui components needed
110
+ b. `src/components/` — app-specific components
111
+ c. `src/pages/` — page components
112
+ d. `src/hooks/` — custom hooks (useApi, useAuth, etc.)
113
+ e. `src/App.tsx` — router with all pages
114
+ f. `src/lib/api.ts` — API client
115
+
116
+ 4. Use the Write tool for new files, Edit tool for modifying scaffold files
117
+
118
+ ### Exit Checklist
119
+ - [ ] Prisma schema has all models defined
120
+ - [ ] All API routes written with proper TypeScript types
121
+ - [ ] All React pages and components written
122
+ - [ ] API client (`src/lib/api.ts`) covers all endpoints
123
+ - [ ] Router in App.tsx includes all pages
124
+
125
+ ---
126
+
127
+ ## Phase 4: VERIFY
128
+
129
+ ### Entry Criteria
130
+ - All application code written
131
+
132
+ ### Actions
133
+ 1. Read the `ai41_app_verify` skill
134
+ 2. Follow its verification loop exactly
135
+ 3. This phase may loop multiple times — that's expected
136
+
137
+ ### Exit Checklist
138
+ - [ ] `npx prisma generate` succeeds
139
+ - [ ] `npx prisma migrate dev --name init` succeeds (or `npx prisma db push`)
140
+ - [ ] Backend `npm run build` (tsc) exits with code 0
141
+ - [ ] Frontend `npm run build` (vite build) exits with code 0
142
+ - [ ] No TypeScript errors
143
+
144
+ ### Max Retries: 5 per step
145
+ ### On Failure: After 5 retries on any step, report the error to user and ask for guidance.
146
+
147
+ ---
148
+
149
+ ## Phase 5: PREVIEW
150
+
151
+ ### Entry Criteria
152
+ - All builds pass clean
153
+
154
+ ### Actions
155
+ 1. Start the backend dev server: `cd backend && npm run dev &`
156
+ 2. Start the frontend dev server: `cd frontend && npm run dev &`
157
+ 3. Wait 3 seconds for servers to start
158
+ 4. Report to user:
159
+ ```
160
+ Preview ready!
161
+ - Frontend: http://localhost:5173
162
+ - Backend API: http://localhost:3001
163
+
164
+ Review the app in your browser. When you're happy, say "deploy" and I'll push it to Railway.
165
+ If you want changes, describe them and I'll update the code.
166
+ ```
167
+
168
+ ### Exit Checklist
169
+ - [ ] Backend running on port 3001
170
+ - [ ] Frontend running on port 5173
171
+ - [ ] User notified of preview URLs
172
+
173
+ ### IMPORTANT: STOP HERE and wait for user response.
174
+ - If user says "deploy" or similar → proceed to Phase 6
175
+ - If user requests changes → go back to Phase 3 (modify mode: edit existing files, don't rewrite everything)
176
+
177
+ ---
178
+
179
+ ## Phase 6: DEPLOY
180
+
181
+ ### Entry Criteria
182
+ - User has confirmed they want to deploy
183
+
184
+ ### Actions
185
+ 1. Read the `ai41_app_deploy` skill
186
+ 2. Follow it exactly — handles Git, GitHub, Railway
187
+ 3. This phase may loop if Railway deployment has errors
188
+
189
+ ### Exit Checklist
190
+ - [ ] Git repo initialized and committed
191
+ - [ ] GitHub repo created and code pushed
192
+ - [ ] Railway project created
193
+ - [ ] Database provisioned on Railway (if needed)
194
+ - [ ] Environment variables set
195
+ - [ ] Deployment healthy
196
+ - [ ] Public URL accessible
197
+
198
+ ### Max Retries: 3 for deployment issues
199
+ ### On Failure: Report Railway logs to user and ask for guidance.
200
+
201
+ ---
202
+
203
+ ## Phase 7: REGISTER
204
+
205
+ ### Entry Criteria
206
+ - App deployed and accessible
207
+
208
+ ### Actions
209
+ 1. Read the `ai41_app_register` skill
210
+ 2. Register the app in the platform
211
+ 3. Create a developer agent for ongoing maintenance
212
+
213
+ ### Exit Checklist
214
+ - [ ] App registered via `create_app` MCP tool
215
+ - [ ] Developer agent created via `create_agent` MCP tool
216
+ - [ ] User informed of: live URL, GitHub repo, developer agent alias
217
+
218
+ ### Final Report to User
219
+ ```
220
+ Your app is live!
221
+
222
+ - URL: https://{app-name}.up.railway.app
223
+ - GitHub: https://github.com/agenticledger/{repo-name}
224
+ - Developer agent: @{app-name}-dev (chat with this agent to make changes)
225
+
226
+ The developer agent has a heartbeat configured to monitor the app's health.
227
+ ```
228
+
229
+ ---
230
+
231
+ ## Rules
232
+
233
+ - Never skip a phase
234
+ - Never skip exit criteria checks
235
+ - If a phase fails after max retries, STOP and ask the user — don't brute force
236
+ - Log your progress: at the start of each phase, tell the user which phase you're entering
237
+ - During BUILD, write complete, production-quality code — not stubs or TODOs
238
+ - Use shadcn/ui components for ALL UI elements (buttons, inputs, cards, tables, modals, dropdowns)
239
+ - Follow the patterns in `ai41_app_patterns` exactly — these are the owner's proven conventions