@andreprado/agentkit 0.1.0-alpha.10

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 (122) hide show
  1. package/README.md +69 -0
  2. package/bin/agentkit.mjs +23 -0
  3. package/docs/guides/add-channel.md +114 -0
  4. package/docs/guides/add-knowledge.md +134 -0
  5. package/docs/guides/add-tool.md +342 -0
  6. package/docs/guides/agentkit-skills-architecture.md +471 -0
  7. package/docs/guides/channel-security.md +81 -0
  8. package/docs/guides/channels-implementation-map.md +243 -0
  9. package/docs/guides/channels-production-handoff.md +102 -0
  10. package/docs/guides/connect-telegram.md +110 -0
  11. package/docs/guides/connect-whatsapp-zapster.md +119 -0
  12. package/docs/guides/create-agent.md +220 -0
  13. package/docs/guides/prepare-deploy.md +209 -0
  14. package/docs/guides/run-evals.md +179 -0
  15. package/docs/guides/security-rules.md +156 -0
  16. package/docs/guides/use-provider.md +140 -0
  17. package/docs/llms-full.txt +876 -0
  18. package/docs/llms.txt +83 -0
  19. package/docs/portable-deploy-release-checklist.md +41 -0
  20. package/package.json +47 -0
  21. package/src/cli/args.ts +36 -0
  22. package/src/cli/cloud-client.ts +265 -0
  23. package/src/cli/commands/channels.ts +810 -0
  24. package/src/cli/commands/knowledge.ts +136 -0
  25. package/src/cli/constants.ts +4 -0
  26. package/src/cli/deploy-chat-ui.ts +392 -0
  27. package/src/cli/deploy-readiness.ts +348 -0
  28. package/src/cli/flags.ts +162 -0
  29. package/src/cli/help.ts +184 -0
  30. package/src/cli/index.ts +1276 -0
  31. package/src/cli/process.ts +31 -0
  32. package/src/cloud/artifact.ts +139 -0
  33. package/src/cloud/client.ts +79 -0
  34. package/src/cloud/contracts.ts +63 -0
  35. package/src/cloud/index.ts +3 -0
  36. package/src/create-project.ts +177 -0
  37. package/src/index.ts +408 -0
  38. package/src/providers/index.ts +25 -0
  39. package/src/providers/pi.ts +286 -0
  40. package/src/providers/test.ts +133 -0
  41. package/src/providers/types.ts +34 -0
  42. package/src/runtime/build.ts +43 -0
  43. package/src/runtime/channel-buffer.ts +30 -0
  44. package/src/runtime/channel-test-harness.ts +112 -0
  45. package/src/runtime/channels/telegram.ts +360 -0
  46. package/src/runtime/channels/website.ts +132 -0
  47. package/src/runtime/channels/whatsapp-meta.ts +71 -0
  48. package/src/runtime/channels/whatsapp-zapster.ts +278 -0
  49. package/src/runtime/channels.ts +138 -0
  50. package/src/runtime/chat.ts +218 -0
  51. package/src/runtime/config.ts +684 -0
  52. package/src/runtime/conversations.ts +38 -0
  53. package/src/runtime/core/deploy-state.ts +54 -0
  54. package/src/runtime/core/manifest.ts +213 -0
  55. package/src/runtime/core/targets.ts +133 -0
  56. package/src/runtime/database.ts +256 -0
  57. package/src/runtime/db-commands.ts +167 -0
  58. package/src/runtime/deploy-readiness.ts +105 -0
  59. package/src/runtime/deploy.ts +1 -0
  60. package/src/runtime/dev-server.ts +1247 -0
  61. package/src/runtime/docs.ts +36 -0
  62. package/src/runtime/env.ts +152 -0
  63. package/src/runtime/errors.ts +13 -0
  64. package/src/runtime/evals.ts +509 -0
  65. package/src/runtime/inspect.ts +203 -0
  66. package/src/runtime/knowledge/chunk.ts +333 -0
  67. package/src/runtime/knowledge/config.ts +135 -0
  68. package/src/runtime/knowledge/embeddings.ts +133 -0
  69. package/src/runtime/knowledge/ingest.ts +521 -0
  70. package/src/runtime/knowledge/prompt-policy.ts +30 -0
  71. package/src/runtime/knowledge/retrieve.ts +283 -0
  72. package/src/runtime/knowledge/schema.ts +56 -0
  73. package/src/runtime/knowledge/tool.ts +64 -0
  74. package/src/runtime/knowledge/vector.ts +258 -0
  75. package/src/runtime/runtime-contract.ts +93 -0
  76. package/src/runtime/spec.ts +152 -0
  77. package/src/runtime/sync.ts +144 -0
  78. package/src/runtime/targets/cloudflare/build.ts +2517 -0
  79. package/src/runtime/targets/container/build.ts +146 -0
  80. package/src/runtime/targets/container/server.ts +33 -0
  81. package/src/runtime/targets/vps/deploy.ts +206 -0
  82. package/src/runtime/tool-runner.ts +65 -0
  83. package/src/runtime/tools.ts +470 -0
  84. package/src/runtime/traces.ts +41 -0
  85. package/src/storage/sqlite.ts +1118 -0
  86. package/src/templates/blank.ts +394 -0
  87. package/src/templates/dentista.ts +1003 -0
  88. package/src/templates/index.ts +33 -0
  89. package/src/templates/skills/agentkit-build-agent/SKILL.md +51 -0
  90. package/src/templates/skills/agentkit-build-agent/templates/appointment-intake.instructions.md +20 -0
  91. package/src/templates/skills/agentkit-build-agent/templates/sales-qualifier.instructions.md +17 -0
  92. package/src/templates/skills/agentkit-build-agent/templates/support-agent.instructions.md +16 -0
  93. package/src/templates/skills/agentkit-capsule/SKILL.md +62 -0
  94. package/src/templates/skills/agentkit-capsule/references/docs-router.md +15 -0
  95. package/src/templates/skills/agentkit-channels/SKILL.md +62 -0
  96. package/src/templates/skills/agentkit-channels/references/channel-buffering.md +58 -0
  97. package/src/templates/skills/agentkit-channels/references/channel-debugging.md +41 -0
  98. package/src/templates/skills/agentkit-channels/references/telegram.md +38 -0
  99. package/src/templates/skills/agentkit-channels/references/whatsapp-zapster.md +44 -0
  100. package/src/templates/skills/agentkit-database/SKILL.md +45 -0
  101. package/src/templates/skills/agentkit-database/templates/appointments.schema.sql +15 -0
  102. package/src/templates/skills/agentkit-database/templates/leads.schema.sql +17 -0
  103. package/src/templates/skills/agentkit-deploy/SKILL.md +44 -0
  104. package/src/templates/skills/agentkit-evals/SKILL.md +60 -0
  105. package/src/templates/skills/agentkit-evals/templates/multi-turn.eval.md +22 -0
  106. package/src/templates/skills/agentkit-evals/templates/no-leak.eval.md +14 -0
  107. package/src/templates/skills/agentkit-evals/templates/smoke.eval.md +14 -0
  108. package/src/templates/skills/agentkit-evals/templates/tool-call.eval.md +18 -0
  109. package/src/templates/skills/agentkit-knowledge/SKILL.md +40 -0
  110. package/src/templates/skills/agentkit-knowledge/templates/faq.md +14 -0
  111. package/src/templates/skills/agentkit-knowledge/templates/policies.md +14 -0
  112. package/src/templates/skills/agentkit-knowledge/templates/prices.csv +3 -0
  113. package/src/templates/skills/agentkit-prompts/SKILL.md +45 -0
  114. package/src/templates/skills/agentkit-prompts/templates/knowledge-grounded-faq.instructions.md +11 -0
  115. package/src/templates/skills/agentkit-provider/SKILL.md +57 -0
  116. package/src/templates/skills/agentkit-security/SKILL.md +55 -0
  117. package/src/templates/skills/agentkit-tools/SKILL.md +36 -0
  118. package/src/templates/skills/agentkit-tools/examples/database-write.tool.md +35 -0
  119. package/src/templates/skills/agentkit-tools/examples/eval-safe-external-action.tool.md +37 -0
  120. package/src/templates/skills/agentkit-tools/examples/lookup-order.tool.md +46 -0
  121. package/src/templates/skills/agentkit-troubleshooting/SKILL.md +52 -0
  122. package/src/templates/support.ts +401 -0
@@ -0,0 +1,394 @@
1
+ import type { AgentTemplate } from ".";
2
+
3
+ export const blankTemplate: AgentTemplate = {
4
+ name: "blank",
5
+ files(projectName: string, context = {}) {
6
+ const storageName = projectName.toLowerCase().replace(/_/g, "-");
7
+
8
+ return [
9
+ {
10
+ path: "package.json",
11
+ contents: `${JSON.stringify(
12
+ {
13
+ name: projectName,
14
+ private: true,
15
+ type: "module",
16
+ scripts: {
17
+ agentkit: "agentkit",
18
+ dev: "agentkit dev",
19
+ chat: "agentkit chat",
20
+ eval: "agentkit eval run",
21
+ typecheck: "tsc --noEmit",
22
+ },
23
+ dependencies: {
24
+ "@andreprado/agentkit": context.agentkitDependency ?? "workspace:*",
25
+ },
26
+ devDependencies: {
27
+ "@types/node": "^24.12.4",
28
+ typescript: "^5.9.3",
29
+ },
30
+ },
31
+ null,
32
+ 2,
33
+ )}
34
+ `,
35
+ },
36
+ {
37
+ path: "tsconfig.json",
38
+ contents: `${JSON.stringify(
39
+ {
40
+ compilerOptions: {
41
+ target: "ES2022",
42
+ module: "ESNext",
43
+ moduleResolution: "Bundler",
44
+ strict: true,
45
+ skipLibCheck: true,
46
+ noEmit: true,
47
+ types: ["node"],
48
+ },
49
+ include: ["**/*.ts"],
50
+ },
51
+ null,
52
+ 2,
53
+ )}
54
+ `,
55
+ },
56
+ {
57
+ path: ".gitignore",
58
+ contents: `.env
59
+ .agentkit/
60
+ node_modules/
61
+ `,
62
+ },
63
+ {
64
+ path: ".env.schema",
65
+ contents: `# Optional: only needed after switching agentkit.config.ts to a Pi-backed real provider.
66
+ OPENAI_API_KEY=
67
+ ANTHROPIC_API_KEY=
68
+ OPENROUTER_API_KEY=
69
+ `,
70
+ },
71
+ {
72
+ path: "agentkit.config.ts",
73
+ contents: `import { defineAgent } from "@andreprado/agentkit";
74
+
75
+ export default defineAgent({
76
+ name: "${projectName}",
77
+ runtime: "edge",
78
+ provider: {
79
+ name: "test",
80
+ model: "fake",
81
+ },
82
+ instructions: "./prompts/instructions.md",
83
+ secrets: [],
84
+ tools: [],
85
+ access: {
86
+ mode: "private",
87
+ },
88
+ storage: {
89
+ driver: "agentkit",
90
+ path: ".agentkit/agentkit.db",
91
+ database: {
92
+ driver: "turso",
93
+ schema: "./schema.sql",
94
+ },
95
+ files: {
96
+ driver: "r2",
97
+ bucket: "agentkit-${storageName}-files",
98
+ prefix: "${projectName}",
99
+ },
100
+ },
101
+ });
102
+ `,
103
+ },
104
+ {
105
+ path: "schema.sql",
106
+ contents: `CREATE TABLE IF NOT EXISTS agent_notes (
107
+ id TEXT PRIMARY KEY,
108
+ content TEXT NOT NULL,
109
+ created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
110
+ );
111
+ `,
112
+ },
113
+ {
114
+ path: "src/agent.ts",
115
+ contents: `export { default } from "../agentkit.config";
116
+ `,
117
+ },
118
+ {
119
+ path: "prompts/instructions.md",
120
+ contents: `You are ${projectName}, a focused AI agent.
121
+
122
+ Answer clearly, ask for missing context when needed, and do not claim to have performed actions you did not perform.
123
+ `,
124
+ },
125
+ {
126
+ path: "evals/smoke.eval.ts",
127
+ contents: `export default {
128
+ name: "smoke",
129
+ input: "Say hello in one short sentence.",
130
+ expect: {
131
+ contains: "hello",
132
+ },
133
+ };
134
+ `,
135
+ },
136
+ {
137
+ path: "AGENTS.md",
138
+ contents: `# ${projectName}
139
+
140
+ This is an AgentKit Agent Capsule.
141
+
142
+ The capsule root is the runtime boundary. Run, inspect, evaluate, and deploy from this directory.
143
+
144
+ ## Coding Agent Workflow
145
+
146
+ When the owner opens this folder in Codex, Claude Code, or another coding agent and asks for a specific agent, treat that request as the product brief.
147
+
148
+ Start building immediately:
149
+
150
+ - Start with \`skills/agentkit-capsule/SKILL.md\`, then use \`npm run agentkit -- docs llms\` as the docs router.
151
+ - Create or update \`AGENT_SPEC.md\` from the owner's request with \`npm run agentkit -- spec init --brief "<owner request>"\`; the owner should not fill this file by hand before work starts.
152
+ - Infer the first useful version from the owner's request.
153
+ - Edit \`prompts/instructions.md\` for the agent behavior.
154
+ - Edit \`agentkit.config.ts\` for provider, tools, secrets, access, and storage.
155
+ - Add TypeScript tools under \`tools/\` when the requested agent needs actions or external data.
156
+ - Add \`sync.ts\`, \`seed.sql\`, and ordered \`migrations/*.sql\` when the requested agent depends on external catalogs or production-shaped data changes.
157
+ - Do not wait for a wizard or recipe. AgentKit provides the scaffold and contract; you decide the implementation from the owner's brief.
158
+ - Ask follow-up questions only when missing information blocks a safe local implementation.
159
+ - State assumptions in the final response.
160
+
161
+ ## Local Commands
162
+
163
+ - \`npm install\`: restore capsule dependencies if this capsule used \`--no-install\`, install failed, or \`node_modules\` was deleted.
164
+ - \`npm run dev\`: run the local Agent Capsule runtime.
165
+ - \`npm run chat -- --message "hello"\`: send one local chat message.
166
+ - \`npm run eval\`: run agent evals.
167
+ - \`npm run agentkit -- spec check\`: verify the local agent implementation contract exists.
168
+ - \`npm run agentkit -- eval from-conversation <conversation-id>\`: turn a real conversation into a regression eval.
169
+ - \`npm run agentkit -- conversations trace <conversation-id>\`: inspect messages, runs, tool calls, inputs, outputs, rendered output, and final responses.
170
+ - \`npm run agentkit -- tool <name> --input fixtures/input.json\`: run one registered tool directly.
171
+ - \`npm run agentkit -- db migrate\`: apply internal migrations and \`schema.sql\` locally.
172
+ - \`npm run agentkit -- db reset --yes\`: recreate the local SQLite database and reapply schema.
173
+ - \`npm run agentkit -- db seed --file seed.sql\`: apply local fixture data after migrate.
174
+ - \`npm run agentkit -- db shell\`: inspect local development data when needed.
175
+ - \`npm run agentkit -- inspect\`: print machine-readable capsule state.
176
+ - \`printf %s "$VALUE" | npm run agentkit -- env set <NAME> --stdin\`: write a local secret value to ignored \`.env\` without putting it in shell history.
177
+ - \`npm run agentkit -- env list\`: list local secret names without printing values.
178
+ - \`npm run agentkit -- docs llms\`: print the lightweight AgentKit docs router.
179
+ - \`npm run agentkit -- docs full\`: print the full AgentKit contract path only when a skill asks for it.
180
+
181
+ ## Testing With A UI
182
+
183
+ - Local UI: run \`npm run dev\`, open the printed \`Chat:\` URL, and tell the owner the exact URL.
184
+ - Hosted UI: after \`npm run agentkit -- deploy\`, run \`npm run agentkit -- chat-ui --deploy\`, open the printed \`Chat:\` URL, and tell the owner it is connected to the hosted deploy.
185
+ - \`test/fake\` is deterministic. It is useful for scaffold checks, direct tool checks, and fake-provider evals, but it does not validate natural conversation quality.
186
+ - Before claiming real conversation behavior is tested, ask the owner which provider to use: OpenRouter, OpenAI, Anthropic, or another supported provider. Do not choose for them.
187
+
188
+ This blank capsule starts with the built-in \`test/fake\` provider, so local chat works without secrets or internet access. It is also deploy-ready by default: the user can edit the prompt, add tools, and run \`npm run agentkit -- deploy\`.
189
+
190
+ ## Local Runtime Contract
191
+
192
+ \`agentkit dev\`, \`agentkit chat\`, and \`agentkit tool\` use AgentKit-managed local development storage. If the capsule has \`schema.sql\`, AgentKit applies it before tools run. Hosted deploy migrates/provisions the managed backend internally.
193
+
194
+ - Chat: \`http://localhost:4123\`
195
+ - API: \`http://localhost:4123/v1/chat\`
196
+ - Inspect: \`http://localhost:4123/_agentkit\`
197
+ - Storage: \`.agentkit/agentkit.db\`
198
+
199
+ ## Database Tools
200
+
201
+ Tools should use the runtime database helper from the tool context:
202
+
203
+ \`\`\`ts
204
+ export const myTool = defineTool({
205
+ name: "my_tool",
206
+ description: "Writes to the agent database.",
207
+ inputSchema: { type: "object", properties: {}, additionalProperties: false },
208
+ async execute(_input, ctx) {
209
+ await ctx.db.execute("INSERT INTO agent_notes (id, content) VALUES (?, ?)", [
210
+ crypto.randomUUID(),
211
+ "created by the AgentKit managed database runtime",
212
+ ]);
213
+ return { ok: true };
214
+ },
215
+ });
216
+ \`\`\`
217
+
218
+ Use \`ctx.db\` as the canonical helper. \`ctx.database\` and \`ctx.storage.sql\` are aliases. Use \`ctx.db.batch([...])\` for atomic writes; local tools can also use \`ctx.db.transaction(async (tx) => ...)\`. Do not import local database drivers or Node-only APIs in tools. AgentKit owns local and hosted database routing.
219
+
220
+ \`schema.sql\` is an idempotent bootstrap file. Use \`CREATE TABLE IF NOT EXISTS\`, \`CREATE INDEX IF NOT EXISTS\`, and safe additive changes. Use ordered \`migrations/*.sql\` for production-shaped schema evolution; \`npm run agentkit -- db migrate\` applies unapplied local migrations before \`schema.sql\`.
221
+
222
+ ## Hosted Deploy
223
+
224
+ - \`npm run agentkit -- deploy\`: deploy the capsule.
225
+ - AgentKit owns the hosted runtime, managed database, file storage, and production secret injection.
226
+ - Local scaffold, dev, chat, eval, inspect, database, and build commands are token-free.
227
+ - Hosted deploy requires an invited AgentKit Cloud alpha token. If no token is stored yet, ask the owner for one and run \`npm run agentkit -- login --token <token>\`.
228
+ - Put production secret values into managed secrets with \`npm run agentkit -- secret set <NAME> --from-local-env\`, \`--from-env\`, or \`--stdin\`, not into committed files or shell history.
229
+ - The user should not choose a deploy target, create hosted databases, create buckets, copy production secrets into this capsule, or run operator/admin commands.
230
+ - Hosted deploy writes the local chat/UI deploy access token to \`.agentkit/chat-access-token.json\`. Create extra client-facing tokens with \`npm run agentkit -- access token create <name> --out <path>\`.
231
+ - Use \`npm run agentkit -- deploy --smoke "hello"\` or \`npm run agentkit -- deploy smoke --message "hello"\` for an official hosted chat smoke check.
232
+
233
+ ## Rules
234
+
235
+ - Keep required local secret names in \`.env.schema\` and values in ignored \`.env\`. AgentKit local commands load \`.env\` directly.
236
+ - Real providers are resolved by AgentKit through the internal Pi SDK backend; keep project code on \`@andreprado/agentkit\`.
237
+ - The owner must choose the real provider before you switch from \`test/fake\`. Update \`agentkit.config.ts\`, \`.env.schema\`, and local/hosted secrets after that choice.
238
+ - Do not commit \`.env\` or \`.agentkit/\`.
239
+ - Edit the agent contract in \`agentkit.config.ts\`.
240
+ - Edit instructions in \`prompts/instructions.md\`.
241
+ `,
242
+ },
243
+ {
244
+ path: "AGENTKIT.md",
245
+ contents: `# AgentKit Docs
246
+
247
+ This folder is an AgentKit Agent Capsule.
248
+
249
+ ## Start Here
250
+
251
+ If the owner asks you to build an agent in natural language, that request is the brief. Do not ask them to fill another file first.
252
+
253
+ Example owner request:
254
+
255
+ > Develop an appointment and intake agent for an ophthalmology office.
256
+
257
+ Turn the request into a working local capsule:
258
+
259
+ - Update \`prompts/instructions.md\` with domain-specific behavior, boundaries, intake questions, and escalation rules.
260
+ - Create or update \`AGENT_SPEC.md\` with \`npm run agentkit -- spec init --brief "<owner request>"\`. The owner gives the general idea; the coding agent turns it into the structured contract.
261
+ - Update \`agentkit.config.ts\` when tools, secrets, provider, or access rules change.
262
+ - Add TypeScript tools under \`tools/\` for real actions or external data.
263
+ - Use \`npm run agentkit -- sync init\` when the agent needs catalog sync, fixture seed data, or ordered migrations.
264
+ - Keep the first version runnable with \`test/fake\` unless the owner explicitly asks for a real provider.
265
+ - Do not use a wizard or recipe. Build the capsule directly from the scaffold, the AgentKit contract, and the owner's brief.
266
+ - Make practical assumptions and list them in your final response.
267
+ - Ask follow-up questions only when missing information blocks a safe local implementation.
268
+
269
+ ## Local Commands
270
+
271
+ \`\`\`sh
272
+ npm run typecheck
273
+ npm run agentkit -- inspect
274
+ npm run chat -- --message "hello"
275
+ \`\`\`
276
+
277
+ \`test/fake\` proves the scaffold and deterministic tool paths. It does not prove natural conversation quality.
278
+
279
+ \`agentkit new\` installs dependencies by default. Run \`npm install\` only if the capsule was created with \`--no-install\`, install failed, or \`node_modules\` was deleted.
280
+
281
+ Set local development secrets without opening code:
282
+
283
+ \`\`\`sh
284
+ printf %s "$OPENAI_API_KEY" | npm run agentkit -- env set OPENAI_API_KEY --stdin
285
+ npm run agentkit -- inspect
286
+ npm run chat -- --message "hello"
287
+ \`\`\`
288
+
289
+ ## Testing With A UI
290
+
291
+ Local UI:
292
+
293
+ \`\`\`sh
294
+ npm run dev
295
+ \`\`\`
296
+
297
+ Open the printed \`Chat:\` URL and tell the owner the exact URL.
298
+
299
+ Hosted deploy UI:
300
+
301
+ \`\`\`sh
302
+ npm run agentkit -- deploy
303
+ npm run agentkit -- chat-ui --deploy
304
+ \`\`\`
305
+
306
+ Open the printed \`Chat:\` URL and tell the owner this local UI is connected to the hosted deploy.
307
+
308
+ Before claiming real conversation behavior has been tested, ask the owner which provider to use: OpenRouter, OpenAI, Anthropic, or another supported provider. Do not choose for them. After they choose, update \`agentkit.config.ts\`, \`.env.schema\`, local secrets, hosted secrets if deploying, then rerun chat/UI checks.
309
+
310
+ If you add a tool, also run a fake-provider tool smoke test:
311
+
312
+ \`\`\`sh
313
+ npm run agentkit -- tool tool_name --input '{}'
314
+ \`\`\`
315
+
316
+ For the lightweight docs router, read the path printed by:
317
+
318
+ \`\`\`sh
319
+ npm run agentkit -- docs llms
320
+ \`\`\`
321
+
322
+ Read the full framework contract with \`npm run agentkit -- docs full\` only when a skill asks for it.
323
+
324
+ ## Hosted Deploy
325
+
326
+ This capsule is hosted-deploy ready by default.
327
+
328
+ 1. Keep \`runtime: "edge"\` and \`storage.driver: "agentkit"\`.
329
+ 2. Put agent-owned tables in \`schema.sql\`. AgentKit applies it locally and migrates/provisions hosted storage during deploy.
330
+ 3. Run \`npm run agentkit -- build\` only when you want to validate the artifact locally.
331
+ 4. If the owner has not logged in yet, ask for an invited AgentKit Cloud alpha token and run \`npm run agentkit -- login --token <token>\`.
332
+ 5. Put production secrets into managed secrets with \`npm run agentkit -- secret set <NAME> --from-local-env\`, \`--from-env\`, or \`--stdin\`.
333
+ 6. Run \`npm run agentkit -- deploy\`.
334
+ 7. Run \`npm run agentkit -- chat-ui --deploy\` to test the hosted agent through a local UI using the auto-created \`.agentkit/chat-access-token.json\`. Create extra client-facing deploy access tokens with \`npm run agentkit -- access token create <name> --out <path>\` when a separate website or app needs its own credential.
335
+ 8. Use \`npm run agentkit -- deploy --smoke "hello"\` during deploy or \`npm run agentkit -- deploy smoke --message "hello"\` afterward for an official hosted smoke check.
336
+
337
+ AgentKit owns hosted infrastructure and production secrets. Do not put production secret values in this capsule. Do not run operator/admin commands from a user capsule.
338
+ `,
339
+ },
340
+ {
341
+ path: "CLAUDE.md",
342
+ contents: `# ${projectName}
343
+
344
+ Use AgentKit conventions when editing this project.
345
+
346
+ - This folder is an Agent Capsule.
347
+ - The agent contract lives in \`agentkit.config.ts\`.
348
+ - The primary prompt lives in \`prompts/instructions.md\`.
349
+ - Local runtime state lives in \`.agentkit/\` and should not be committed.
350
+ - The default provider is \`test/fake\`, which needs no secrets.
351
+ - Real providers run through AgentKit's internal Pi SDK backend.
352
+ - Ask the owner which real provider to use before switching from \`test/fake\`; do not choose OpenRouter, OpenAI, or Anthropic automatically.
353
+ - Production secrets must be managed secrets, not committed files.
354
+ - Keep required local secret names in \`.env.schema\` and values in ignored \`.env\`. AgentKit local commands load \`.env\` directly.
355
+ - Treat the owner's natural-language request as the brief and start implementing inside this capsule.
356
+ - Start with \`skills/agentkit-capsule/SKILL.md\` when the task is not obvious.
357
+ `,
358
+ },
359
+ {
360
+ path: "README.md",
361
+ contents: `# ${projectName}
362
+
363
+ Generated by AgentKit as an Agent Capsule.
364
+
365
+ ## Setup
366
+
367
+ \`\`\`sh
368
+ npm run chat -- --message "hello"
369
+ npm run dev
370
+ \`\`\`
371
+
372
+ \`agentkit new\` installs dependencies by default. Run \`npm install\` only if this capsule was created with \`--no-install\`, install failed, or \`node_modules\` was deleted.
373
+
374
+ \`agentkit.config.ts\` uses the built-in \`test/fake\` provider by default, so the first chat works without editing \`.env\`.
375
+ When a real provider or tool needs a local development secret, keep the required name in \`.env.schema\`, keep the value in ignored \`.env\`, and run AgentKit commands normally; the local runtime loads \`.env\` directly.
376
+
377
+ \`npm run dev\` runs the whole capsule locally. It should expose local chat, API, inspect, and storage endpoints.
378
+
379
+ For UI testing, run \`npm run dev\` and open the printed \`Chat:\` URL. After hosted deploy, run \`npm run agentkit -- chat-ui --deploy\` and open its printed \`Chat:\` URL.
380
+
381
+ \`test/fake\` does not validate real conversation quality. The owner must choose OpenRouter, OpenAI, Anthropic, or another supported provider before real model behavior is tested.
382
+
383
+ ## Files
384
+
385
+ - \`agentkit.config.ts\`: agent contract.
386
+ - \`schema.sql\`: source of truth for agent-owned tables. Applied locally during development and migrated/provisioned internally during hosted deploys.
387
+ - \`prompts/instructions.md\`: agent instructions.
388
+ - \`evals/\`: eval cases.
389
+ - \`.agentkit/\`: local runtime state.
390
+ `,
391
+ },
392
+ ];
393
+ },
394
+ };