@andreprado/agentkit 0.1.0-alpha.5 → 0.1.0-alpha.7
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.
- package/README.md +9 -0
- package/docs/guides/add-channel.md +25 -0
- package/docs/guides/add-knowledge.md +134 -0
- package/docs/guides/agentkit-skills-architecture.md +471 -0
- package/docs/guides/channels-production-handoff.md +2 -0
- package/docs/guides/connect-telegram.md +17 -0
- package/docs/guides/connect-whatsapp-zapster.md +16 -0
- package/docs/guides/create-agent.md +10 -1
- package/docs/guides/run-evals.md +36 -1
- package/docs/llms-full.txt +90 -1
- package/docs/llms.txt +9 -2
- package/package.json +2 -1
- package/src/cli/cloud-client.ts +10 -2
- package/src/cli/commands/channels.ts +67 -3
- package/src/cli/commands/knowledge.ts +136 -0
- package/src/cli/deploy-chat-ui.ts +7 -0
- package/src/cli/deploy-readiness.ts +19 -0
- package/src/cli/help.ts +26 -2
- package/src/cli/index.ts +140 -8
- package/src/cloud/artifact.ts +92 -1
- package/src/cloud/contracts.ts +16 -0
- package/src/create-project.ts +38 -6
- package/src/index.ts +142 -1
- package/src/providers/pi.ts +1 -1
- package/src/providers/test.ts +1 -1
- package/src/runtime/channel-buffer.ts +30 -0
- package/src/runtime/channels.ts +1 -0
- package/src/runtime/chat.ts +21 -2
- package/src/runtime/config.ts +175 -0
- package/src/runtime/core/manifest.ts +37 -0
- package/src/runtime/database.ts +93 -2
- package/src/runtime/db-commands.ts +9 -0
- package/src/runtime/deploy-readiness.ts +12 -0
- package/src/runtime/dev-server.ts +201 -11
- package/src/runtime/evals.ts +210 -20
- package/src/runtime/inspect.ts +39 -0
- package/src/runtime/knowledge/chunk.ts +333 -0
- package/src/runtime/knowledge/config.ts +135 -0
- package/src/runtime/knowledge/embeddings.ts +133 -0
- package/src/runtime/knowledge/ingest.ts +521 -0
- package/src/runtime/knowledge/prompt-policy.ts +30 -0
- package/src/runtime/knowledge/retrieve.ts +283 -0
- package/src/runtime/knowledge/schema.ts +56 -0
- package/src/runtime/knowledge/tool.ts +64 -0
- package/src/runtime/knowledge/vector.ts +258 -0
- package/src/runtime/spec.ts +152 -0
- package/src/runtime/sync.ts +144 -0
- package/src/runtime/targets/cloudflare/build.ts +514 -4
- package/src/runtime/tools.ts +121 -1
- package/src/runtime/traces.ts +41 -0
- package/src/storage/sqlite.ts +141 -0
- package/src/templates/blank.ts +16 -5
- package/src/templates/dentista.ts +17 -2
- package/src/templates/skills/agentkit-build-agent/SKILL.md +51 -0
- package/src/templates/skills/agentkit-build-agent/templates/appointment-intake.instructions.md +20 -0
- package/src/templates/skills/agentkit-build-agent/templates/sales-qualifier.instructions.md +17 -0
- package/src/templates/skills/agentkit-build-agent/templates/support-agent.instructions.md +16 -0
- package/src/templates/skills/agentkit-capsule/SKILL.md +62 -0
- package/src/templates/skills/agentkit-capsule/references/docs-router.md +15 -0
- package/src/templates/skills/agentkit-channels/SKILL.md +62 -0
- package/src/templates/skills/agentkit-channels/references/channel-buffering.md +58 -0
- package/src/templates/skills/agentkit-channels/references/channel-debugging.md +37 -0
- package/src/templates/skills/agentkit-channels/references/telegram.md +37 -0
- package/src/templates/skills/agentkit-channels/references/whatsapp-zapster.md +37 -0
- package/src/templates/skills/agentkit-database/SKILL.md +45 -0
- package/src/templates/skills/agentkit-database/templates/appointments.schema.sql +15 -0
- package/src/templates/skills/agentkit-database/templates/leads.schema.sql +17 -0
- package/src/templates/skills/agentkit-deploy/SKILL.md +44 -0
- package/src/templates/skills/agentkit-evals/SKILL.md +60 -0
- package/src/templates/skills/agentkit-evals/templates/multi-turn.eval.md +22 -0
- package/src/templates/skills/agentkit-evals/templates/no-leak.eval.md +14 -0
- package/src/templates/skills/agentkit-evals/templates/smoke.eval.md +14 -0
- package/src/templates/skills/agentkit-evals/templates/tool-call.eval.md +18 -0
- package/src/templates/skills/agentkit-knowledge/SKILL.md +40 -0
- package/src/templates/skills/agentkit-knowledge/templates/faq.md +14 -0
- package/src/templates/skills/agentkit-knowledge/templates/policies.md +14 -0
- package/src/templates/skills/agentkit-knowledge/templates/prices.csv +3 -0
- package/src/templates/skills/agentkit-prompts/SKILL.md +45 -0
- package/src/templates/skills/agentkit-prompts/templates/knowledge-grounded-faq.instructions.md +11 -0
- package/src/templates/skills/agentkit-provider/SKILL.md +57 -0
- package/src/templates/skills/agentkit-security/SKILL.md +55 -0
- package/src/templates/skills/agentkit-tools/SKILL.md +36 -0
- package/src/templates/skills/agentkit-tools/examples/database-write.tool.md +35 -0
- package/src/templates/skills/agentkit-tools/examples/eval-safe-external-action.tool.md +37 -0
- package/src/templates/skills/agentkit-tools/examples/lookup-order.tool.md +46 -0
- package/src/templates/skills/agentkit-troubleshooting/SKILL.md +52 -0
- package/src/templates/support.ts +15 -4
package/README.md
CHANGED
|
@@ -34,11 +34,20 @@ Once the capsule is running:
|
|
|
34
34
|
|
|
35
35
|
```sh
|
|
36
36
|
agentkit tool <name> [--input <path-or-json>]
|
|
37
|
+
agentkit knowledge add <path-or-url>
|
|
38
|
+
agentkit knowledge sync
|
|
39
|
+
agentkit knowledge search <query> [--top-k <number>]
|
|
40
|
+
agentkit spec init --brief <text>
|
|
37
41
|
agentkit db migrate
|
|
42
|
+
agentkit sync run
|
|
38
43
|
agentkit eval run
|
|
44
|
+
agentkit eval from-conversation <conversation-id>
|
|
39
45
|
agentkit conversations list
|
|
46
|
+
agentkit conversations trace <conversation-id>
|
|
40
47
|
```
|
|
41
48
|
|
|
49
|
+
Knowledge indexes local `.md`, `.txt`, and `.csv` sources into the capsule database and registers the internal `agentkit_search_knowledge` chat tool when `knowledge` is configured in `agentkit.config.ts`. `agentkit dev` and `agentkit chat` sync configured sources automatically; when embeddings are configured, local semantic search uses a libSQL vector sidecar. Hosted Cloudflare deploys package configured local Knowledge sources and sync them into the project Turso database automatically during `agentkit deploy`; when embeddings are configured, the deploy also creates and populates the hosted Turso vector index.
|
|
50
|
+
|
|
42
51
|
## Deploy Later
|
|
43
52
|
|
|
44
53
|
```sh
|
|
@@ -54,12 +54,35 @@ export default defineAgent({
|
|
|
54
54
|
});
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
+
## Buffer Bursty Messages
|
|
58
|
+
|
|
59
|
+
Use `buffer` when clients send several short messages in a row and the agent should answer once.
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
whatsappChannel({
|
|
63
|
+
name: "support-whatsapp",
|
|
64
|
+
provider: "zapster",
|
|
65
|
+
buffer: {
|
|
66
|
+
mode: "debounce",
|
|
67
|
+
quietWindowMs: 2500,
|
|
68
|
+
maxWaitMs: 12000,
|
|
69
|
+
maxMessages: 20,
|
|
70
|
+
maxChars: 8000,
|
|
71
|
+
},
|
|
72
|
+
})
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Buffering is scoped to one channel conversation. AgentKit still validates and dedupes each provider webhook, then stores the messages in a short-lived channel buffer. When the quiet window expires, AgentKit creates one agent run with the buffered messages and sends one outbound reply.
|
|
76
|
+
|
|
77
|
+
Use `buffer: { mode: "off" }` or omit `buffer` to process each inbound message as its own agent run.
|
|
78
|
+
|
|
57
79
|
## Safety Rules
|
|
58
80
|
|
|
59
81
|
- Never put provider token values in `agentkit.config.ts`.
|
|
60
82
|
- Keep local values in ignored `.env`; hosted production uses managed secrets with no readback.
|
|
61
83
|
- Treat channel webhook URLs as public transport endpoints. Provider validation or the AgentKit website channel token controls authenticity.
|
|
62
84
|
- Keep channels separate from tools. Channels deliver user messages; tools let the agent call external systems.
|
|
85
|
+
- Keep `maxMessages` and `maxChars` bounded so one burst cannot create an oversized prompt or unexpected model spend.
|
|
63
86
|
|
|
64
87
|
## Verification
|
|
65
88
|
|
|
@@ -87,3 +110,5 @@ The provider webhook secret/token does not match the managed secret.
|
|
|
87
110
|
|
|
88
111
|
`channel_limit_exceeded`:
|
|
89
112
|
The channel daily message limit was reached. Website requests return `429`; Telegram and WhatsApp are acknowledged and skipped to avoid provider retry storms.
|
|
113
|
+
|
|
114
|
+
Buffered messages stay in `buffered` delivery state until the quiet window or max wait flushes them into one queued run.
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Add Knowledge
|
|
2
|
+
|
|
3
|
+
Knowledge is AgentKit's native retrieval layer for facts the agent should not invent: policies, prices, service details, FAQs, CSV tables, procedures, and internal reference docs.
|
|
4
|
+
|
|
5
|
+
Use Knowledge when the answer should come from source files instead of the base prompt. Do not use Knowledge for secrets, credentials, or data that should only be fetched live through a tool.
|
|
6
|
+
|
|
7
|
+
## Configure
|
|
8
|
+
|
|
9
|
+
Create a `knowledge/` directory in the Agent Capsule and list the sources in `agentkit.config.ts`:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
export default defineAgent({
|
|
13
|
+
// ...
|
|
14
|
+
knowledge: {
|
|
15
|
+
sources: [
|
|
16
|
+
"knowledge/faq.md",
|
|
17
|
+
{ path: "knowledge/prices.csv", title: "Prices" },
|
|
18
|
+
],
|
|
19
|
+
retrieval: {
|
|
20
|
+
topK: 8,
|
|
21
|
+
hybrid: false,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Local Knowledge supports `.md`, `.markdown`, `.txt`, and `.csv` files. Markdown is chunked by headings, text is chunked by paragraphs, and CSV rows preserve column headers.
|
|
28
|
+
|
|
29
|
+
The default embedding provider is `none`, which gives local lexical search without an API key. To add embeddings, configure them separately from the chat provider:
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
knowledge: {
|
|
33
|
+
sources: ["knowledge/faq.md"],
|
|
34
|
+
embedding: {
|
|
35
|
+
provider: "openai",
|
|
36
|
+
model: "text-embedding-3-small",
|
|
37
|
+
secret: "KNOWLEDGE_OPENAI_API_KEY",
|
|
38
|
+
},
|
|
39
|
+
retrieval: {
|
|
40
|
+
topK: 8,
|
|
41
|
+
hybrid: true,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Then set the local secret without committing it:
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
printf %s "$KNOWLEDGE_OPENAI_API_KEY" | agentkit env set KNOWLEDGE_OPENAI_API_KEY --stdin
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Index Locally
|
|
53
|
+
|
|
54
|
+
Index one source:
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
agentkit knowledge add knowledge/faq.md
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Sync all configured sources:
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
agentkit knowledge sync
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Inspect indexed sources:
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
agentkit knowledge inspect
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Search locally:
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
agentkit knowledge search "refund policy" --top-k 3
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
`knowledge add` is useful for one-off local indexing. `knowledge sync` validates and indexes all configured `knowledge.sources` on demand. `agentkit dev` and `agentkit chat` also sync configured Knowledge automatically before local runs, and unchanged files are skipped by content hash.
|
|
79
|
+
|
|
80
|
+
When embeddings are configured locally, AgentKit stores canonical Knowledge chunks in `.agentkit/agentkit.db` and rebuilds a local libSQL vector sidecar at `.agentkit/agentkit.vectors.db`. Local semantic search uses the sidecar's native `libsql_vector_idx` path and falls back to stored JSON embeddings if the native vector path is unavailable.
|
|
81
|
+
|
|
82
|
+
## Agent Behavior
|
|
83
|
+
|
|
84
|
+
When `knowledge` is configured, AgentKit automatically registers the internal tool `agentkit_search_knowledge` during chat runs and appends a prompt policy. The policy tells the agent to search before answering business-specific factual questions and not to expose raw retrieval JSON, scores, or chunk IDs.
|
|
85
|
+
|
|
86
|
+
With the deterministic `test/fake` provider, verify the internal tool directly:
|
|
87
|
+
|
|
88
|
+
```sh
|
|
89
|
+
agentkit chat --message '{"tool":"agentkit_search_knowledge","input":{"query":"refund policy","topK":1}}'
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Expected output:
|
|
93
|
+
|
|
94
|
+
```txt
|
|
95
|
+
Tool agentkit_search_knowledge: completed
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The retrieved chunks are persisted as internal tool output in local SQLite for evals and inspection, but they are not shown directly to the user.
|
|
99
|
+
|
|
100
|
+
## Hosted Deploy
|
|
101
|
+
|
|
102
|
+
Cloudflare Knowledge deploys require AgentKit-managed Turso storage:
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
storage: {
|
|
106
|
+
driver: "agentkit",
|
|
107
|
+
database: {
|
|
108
|
+
driver: "turso",
|
|
109
|
+
schema: "./schema.sql",
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
`agentkit deploy doctor` and `agentkit build --target cloudflare` fail with an actionable error when Knowledge is configured without Turso. The Cloudflare artifact includes the Knowledge manifest, required embedding secret names, internal Knowledge schema, local source file contents, prompt policy, and hosted `agentkit_search_knowledge` runtime.
|
|
115
|
+
|
|
116
|
+
During `agentkit deploy`, AgentKit Cloud provisions or resolves the project Turso database, applies the Knowledge schema, chunks every packaged local source, creates embeddings when an embedding provider is configured, and writes sources, chunks, embedding metadata, FTS rows, and a native Turso `libsql_vector_idx` index into Turso before publishing the Worker. Removed configured sources are deleted from the hosted Knowledge tables during sync.
|
|
117
|
+
|
|
118
|
+
Local `agentkit knowledge add`, `agentkit knowledge sync`, `agentkit dev`, and `agentkit chat` index configured Knowledge into the local SQLite database and local libSQL vector sidecar. Hosted deploy syncs configured local Knowledge sources automatically from the deploy artifact so embedding secrets stay server-side and private source material does not move into client code. Hosted semantic search uses Turso native vector search when embeddings are configured and falls back to stored JSON embeddings if the native vector path is unavailable.
|
|
119
|
+
|
|
120
|
+
## Safety Rules
|
|
121
|
+
|
|
122
|
+
- Do not put API keys, passwords, private tokens, `.env` contents, or credential exports in Knowledge files.
|
|
123
|
+
- Treat committed Knowledge files as repository content. Use a private repo for private business docs.
|
|
124
|
+
- Use tools for live customer records, payments, orders, or anything requiring authorization checks.
|
|
125
|
+
- Use explicit `title` fields for CSVs or ambiguous files so search results have useful citations.
|
|
126
|
+
- Use `agentkit knowledge sync` to validate source changes explicitly; local `agentkit dev` and `agentkit chat` also sync configured sources automatically.
|
|
127
|
+
|
|
128
|
+
## Troubleshooting
|
|
129
|
+
|
|
130
|
+
- `No knowledge.sources are configured`: add `knowledge.sources` to `agentkit.config.ts` or use `agentkit knowledge add <path>`.
|
|
131
|
+
- `Knowledge source paths must stay inside the Agent Capsule`: move the source under the capsule root, usually `knowledge/`.
|
|
132
|
+
- `Local Knowledge currently supports .md, .txt, and .csv files`: convert the source or add a tool for unsupported formats.
|
|
133
|
+
- `Knowledge embeddings require missing secret`: set the env var named by `knowledge.embedding.secret`.
|
|
134
|
+
- Hosted build says Turso is required: add `storage.database.driver: "turso"` before deploying Knowledge.
|
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
# AgentKit Skills Architecture
|
|
2
|
+
|
|
3
|
+
## Recommendation
|
|
4
|
+
|
|
5
|
+
Ship AgentKit skills as the default interface for the user's coding agent, while keeping the docs as the canonical source of truth.
|
|
6
|
+
|
|
7
|
+
The current docs remain authoritative:
|
|
8
|
+
|
|
9
|
+
```txt
|
|
10
|
+
docs/llms.txt short router
|
|
11
|
+
docs/llms-full.txt complete operating contract
|
|
12
|
+
docs/guides/*.md task guides
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Skills should become the context-efficient working surface:
|
|
16
|
+
|
|
17
|
+
```txt
|
|
18
|
+
skills/agentkit-capsule/SKILL.md
|
|
19
|
+
skills/agentkit-tools/SKILL.md
|
|
20
|
+
skills/agentkit-deploy/SKILL.md
|
|
21
|
+
...
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The default agent path should be:
|
|
25
|
+
|
|
26
|
+
```txt
|
|
27
|
+
AGENTS.md
|
|
28
|
+
-> skills/agentkit-capsule/SKILL.md
|
|
29
|
+
-> one task skill
|
|
30
|
+
-> one reference, example, or template only when needed
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Do not make `llms-full.txt` part of the default handoff. It is the full contract and should be loaded only for ambiguous framework behavior, internals work, or broad audits.
|
|
34
|
+
|
|
35
|
+
## Problem
|
|
36
|
+
|
|
37
|
+
`docs/llms-full.txt` is useful but too large for ordinary agent work. Loading it by default spends context on deploy, channels, backend contracts, evals, and storage details even when the owner only asked for a prompt change or one tool.
|
|
38
|
+
|
|
39
|
+
The generated capsule files and `agentkit handoff` currently tell coding agents to read the full docs path. That is correct for completeness, but not for context economy.
|
|
40
|
+
|
|
41
|
+
Skills solve this because they use progressive disclosure:
|
|
42
|
+
|
|
43
|
+
- metadata is always discoverable;
|
|
44
|
+
- `SKILL.md` loads only when the task matches;
|
|
45
|
+
- examples, templates, scripts, and references load only when selected by the skill.
|
|
46
|
+
|
|
47
|
+
## Product Contract
|
|
48
|
+
|
|
49
|
+
AgentKit should ship skills out of the box for agents that support repo-local skills.
|
|
50
|
+
|
|
51
|
+
Generated capsules should include:
|
|
52
|
+
|
|
53
|
+
```txt
|
|
54
|
+
skills/
|
|
55
|
+
agentkit-capsule/
|
|
56
|
+
SKILL.md
|
|
57
|
+
references/
|
|
58
|
+
docs-router.md
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Template-specific and task-specific skills can live either:
|
|
62
|
+
|
|
63
|
+
- inside the generated capsule, for maximum out-of-the-box usability; or
|
|
64
|
+
- inside the installed AgentKit package, copied into the capsule by `agentkit new`.
|
|
65
|
+
|
|
66
|
+
The generated capsule must still include `AGENTS.md`, `AGENTKIT.md`, `CLAUDE.md`, and `README.md` for agents or tools that do not support skills.
|
|
67
|
+
|
|
68
|
+
## Skill Design Rules
|
|
69
|
+
|
|
70
|
+
Each `SKILL.md` should be short and procedural. Target 300-800 words.
|
|
71
|
+
|
|
72
|
+
Every skill should include:
|
|
73
|
+
|
|
74
|
+
- when to use it;
|
|
75
|
+
- files to inspect;
|
|
76
|
+
- files it may edit;
|
|
77
|
+
- exact commands;
|
|
78
|
+
- safety rules;
|
|
79
|
+
- verification;
|
|
80
|
+
- links to optional references, examples, templates, or assets.
|
|
81
|
+
|
|
82
|
+
Each skill should avoid:
|
|
83
|
+
|
|
84
|
+
- duplicating whole guides;
|
|
85
|
+
- copying large code examples into `SKILL.md`;
|
|
86
|
+
- requiring `llms-full.txt` by default;
|
|
87
|
+
- mixing user-capsule workflows with AgentKit maintainer/operator workflows.
|
|
88
|
+
|
|
89
|
+
Use bundled resources this way:
|
|
90
|
+
|
|
91
|
+
```txt
|
|
92
|
+
references/ deeper task notes loaded only when needed
|
|
93
|
+
examples/ source examples the agent may inspect
|
|
94
|
+
templates/ starter files the agent may copy and adapt
|
|
95
|
+
scripts/ deterministic helpers for fragile/repeated tasks
|
|
96
|
+
assets/ files used as output resources
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Core Skills To Ship
|
|
100
|
+
|
|
101
|
+
### agentkit-capsule
|
|
102
|
+
|
|
103
|
+
The always-first router for work inside an Agent Capsule.
|
|
104
|
+
|
|
105
|
+
Use when the agent detects `agentkit.config.ts` or the owner asks to build/change an AgentKit agent.
|
|
106
|
+
|
|
107
|
+
Responsibilities:
|
|
108
|
+
|
|
109
|
+
- establish the capsule root as the runtime boundary;
|
|
110
|
+
- read `AGENTS.md` or `AGENTKIT.md`;
|
|
111
|
+
- route to one task skill;
|
|
112
|
+
- prefer `agentkit docs llms` over `agentkit docs full`;
|
|
113
|
+
- load `llms-full.txt` only when the task needs the complete contract;
|
|
114
|
+
- run the baseline checks before completion.
|
|
115
|
+
|
|
116
|
+
Default verification:
|
|
117
|
+
|
|
118
|
+
```sh
|
|
119
|
+
npm run typecheck
|
|
120
|
+
npm run agentkit -- inspect
|
|
121
|
+
npm run chat -- --message "hello"
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### agentkit-build-agent
|
|
125
|
+
|
|
126
|
+
Use when the owner gives a natural-language brief for a new or changed agent.
|
|
127
|
+
|
|
128
|
+
Responsibilities:
|
|
129
|
+
|
|
130
|
+
- translate the brief into prompt, tools, schema, evals, and assumptions;
|
|
131
|
+
- keep the first useful version runnable with `test/fake` unless the owner chooses a real provider;
|
|
132
|
+
- create domain-specific local behavior without waiting for a wizard;
|
|
133
|
+
- add evals for the expected first behavior.
|
|
134
|
+
|
|
135
|
+
Likely templates:
|
|
136
|
+
|
|
137
|
+
```txt
|
|
138
|
+
templates/support-agent.instructions.md
|
|
139
|
+
templates/appointment-intake.instructions.md
|
|
140
|
+
templates/sales-qualifier.instructions.md
|
|
141
|
+
templates/internal-operations.instructions.md
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### agentkit-prompts
|
|
145
|
+
|
|
146
|
+
Use when editing `prompts/instructions.md` or designing the agent's behavior.
|
|
147
|
+
|
|
148
|
+
Responsibilities:
|
|
149
|
+
|
|
150
|
+
- define role, boundaries, escalation rules, tone, and tool-use policy;
|
|
151
|
+
- prevent false claims about actions not performed;
|
|
152
|
+
- describe when to use Knowledge versus tools;
|
|
153
|
+
- keep user-facing behavior specific to the owner's domain.
|
|
154
|
+
|
|
155
|
+
Likely templates:
|
|
156
|
+
|
|
157
|
+
```txt
|
|
158
|
+
templates/knowledge-grounded-faq.instructions.md
|
|
159
|
+
templates/appointment-intake.instructions.md
|
|
160
|
+
templates/support-agent.instructions.md
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### agentkit-tools
|
|
164
|
+
|
|
165
|
+
Use when adding or changing TypeScript tools.
|
|
166
|
+
|
|
167
|
+
Responsibilities:
|
|
168
|
+
|
|
169
|
+
- create `defineTool` tools with input/output schemas;
|
|
170
|
+
- register tools in `agentkit.config.ts`;
|
|
171
|
+
- declare tool secrets and permissions;
|
|
172
|
+
- add timeouts;
|
|
173
|
+
- test tools directly;
|
|
174
|
+
- keep eval runs deterministic and non-destructive.
|
|
175
|
+
|
|
176
|
+
Likely examples:
|
|
177
|
+
|
|
178
|
+
```txt
|
|
179
|
+
examples/lookup-order.tool.ts
|
|
180
|
+
examples/external-api-lookup.tool.ts
|
|
181
|
+
examples/eval-safe-send-email.tool.ts
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Primary reference: `docs/guides/add-tool.md`.
|
|
185
|
+
|
|
186
|
+
### agentkit-database
|
|
187
|
+
|
|
188
|
+
Use when adding agent-owned tables or database-backed tools.
|
|
189
|
+
|
|
190
|
+
Responsibilities:
|
|
191
|
+
|
|
192
|
+
- edit `schema.sql`;
|
|
193
|
+
- keep schema changes idempotent;
|
|
194
|
+
- use `ctx.db` in tools;
|
|
195
|
+
- avoid local database driver imports;
|
|
196
|
+
- run local migration/seed/shell checks;
|
|
197
|
+
- preserve deploy-compatible `storage.driver: "agentkit"`.
|
|
198
|
+
|
|
199
|
+
Likely templates:
|
|
200
|
+
|
|
201
|
+
```txt
|
|
202
|
+
templates/appointments.schema.sql
|
|
203
|
+
templates/leads.schema.sql
|
|
204
|
+
templates/tickets.schema.sql
|
|
205
|
+
templates/notes.schema.sql
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Primary reference: `docs/guides/add-tool.md` database section and `docs/guides/prepare-deploy.md`.
|
|
209
|
+
|
|
210
|
+
### agentkit-knowledge
|
|
211
|
+
|
|
212
|
+
Use when the agent should answer from committed source files such as FAQs, prices, policies, CSVs, and procedures.
|
|
213
|
+
|
|
214
|
+
Responsibilities:
|
|
215
|
+
|
|
216
|
+
- create `knowledge/` sources;
|
|
217
|
+
- configure `knowledge.sources`;
|
|
218
|
+
- choose lexical search by default;
|
|
219
|
+
- configure embeddings only when needed;
|
|
220
|
+
- verify with `knowledge sync` and `knowledge search`;
|
|
221
|
+
- keep secrets and live customer data out of Knowledge.
|
|
222
|
+
|
|
223
|
+
Likely templates:
|
|
224
|
+
|
|
225
|
+
```txt
|
|
226
|
+
templates/faq.md
|
|
227
|
+
templates/prices.csv
|
|
228
|
+
templates/policies.md
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Primary reference: `docs/guides/add-knowledge.md`.
|
|
232
|
+
|
|
233
|
+
### agentkit-provider
|
|
234
|
+
|
|
235
|
+
Use when switching from `test/fake` to a real provider.
|
|
236
|
+
|
|
237
|
+
Responsibilities:
|
|
238
|
+
|
|
239
|
+
- ask the owner which provider to use;
|
|
240
|
+
- update `agentkit.config.ts`;
|
|
241
|
+
- update `.env.schema`;
|
|
242
|
+
- set local secrets through AgentKit commands;
|
|
243
|
+
- verify with chat, inspect, and UI;
|
|
244
|
+
- never import provider SDKs into the capsule.
|
|
245
|
+
|
|
246
|
+
Primary reference: `docs/guides/use-provider.md`.
|
|
247
|
+
|
|
248
|
+
### agentkit-evals
|
|
249
|
+
|
|
250
|
+
Use when adding or running evals.
|
|
251
|
+
|
|
252
|
+
Responsibilities:
|
|
253
|
+
|
|
254
|
+
- create `evals/*.eval.ts`;
|
|
255
|
+
- use deterministic assertions;
|
|
256
|
+
- verify persisted tool calls;
|
|
257
|
+
- avoid real PII and secrets;
|
|
258
|
+
- guard external side effects with `ctx.runtime.environment === "eval"`;
|
|
259
|
+
- run `npm run eval`.
|
|
260
|
+
|
|
261
|
+
Likely templates:
|
|
262
|
+
|
|
263
|
+
```txt
|
|
264
|
+
templates/smoke.eval.ts
|
|
265
|
+
templates/tool-call.eval.ts
|
|
266
|
+
templates/no-leak.eval.ts
|
|
267
|
+
templates/knowledge-answer.eval.ts
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Primary reference: `docs/guides/run-evals.md`.
|
|
271
|
+
|
|
272
|
+
### agentkit-deploy
|
|
273
|
+
|
|
274
|
+
Use when preparing or running hosted deploy.
|
|
275
|
+
|
|
276
|
+
Responsibilities:
|
|
277
|
+
|
|
278
|
+
- run readiness checks;
|
|
279
|
+
- keep hosting target selection inside AgentKit;
|
|
280
|
+
- use managed secrets, not committed `.env`;
|
|
281
|
+
- run `deploy doctor`;
|
|
282
|
+
- run `deploy --smoke`;
|
|
283
|
+
- run hosted UI checks;
|
|
284
|
+
- report production handoff details when deploy is ready.
|
|
285
|
+
|
|
286
|
+
Primary reference: `docs/guides/prepare-deploy.md`.
|
|
287
|
+
|
|
288
|
+
### agentkit-security
|
|
289
|
+
|
|
290
|
+
Use before or during any work involving secrets, external APIs, tools, evals from conversations, public access, channels, or hosted deploys.
|
|
291
|
+
|
|
292
|
+
Responsibilities:
|
|
293
|
+
|
|
294
|
+
- prevent `.env`, `.agentkit/`, and secret values from being committed;
|
|
295
|
+
- enforce secret-name-only config;
|
|
296
|
+
- confirm tool secrets and permissions;
|
|
297
|
+
- check access mode assumptions;
|
|
298
|
+
- require redaction for client data.
|
|
299
|
+
|
|
300
|
+
Primary reference: `docs/guides/security-rules.md`.
|
|
301
|
+
|
|
302
|
+
### agentkit-channels
|
|
303
|
+
|
|
304
|
+
Use when adding, connecting, testing, or debugging website, Telegram, or WhatsApp channels.
|
|
305
|
+
|
|
306
|
+
Responsibilities:
|
|
307
|
+
|
|
308
|
+
- add channel config helpers;
|
|
309
|
+
- deploy before hosted channel creation;
|
|
310
|
+
- manage provider secret names;
|
|
311
|
+
- verify setup/status/test/delivery logs;
|
|
312
|
+
- separate channels from tools;
|
|
313
|
+
- debug webhook and delivery errors without leaking provider payloads.
|
|
314
|
+
|
|
315
|
+
Likely references:
|
|
316
|
+
|
|
317
|
+
```txt
|
|
318
|
+
references/telegram.md
|
|
319
|
+
references/whatsapp-zapster.md
|
|
320
|
+
references/channel-debugging.md
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Primary references:
|
|
324
|
+
|
|
325
|
+
- `docs/guides/add-channel.md`
|
|
326
|
+
- `docs/guides/connect-telegram.md`
|
|
327
|
+
- `docs/guides/connect-whatsapp-zapster.md`
|
|
328
|
+
- `docs/guides/debug-channel.md`
|
|
329
|
+
- `docs/guides/channel-security.md`
|
|
330
|
+
|
|
331
|
+
### agentkit-troubleshooting
|
|
332
|
+
|
|
333
|
+
Use when AgentKit commands fail or the agent is unsure which task skill applies.
|
|
334
|
+
|
|
335
|
+
Responsibilities:
|
|
336
|
+
|
|
337
|
+
- start from the error code;
|
|
338
|
+
- run `inspect`;
|
|
339
|
+
- check config, secrets, package install, provider, storage, and channel state;
|
|
340
|
+
- route to a more specific skill;
|
|
341
|
+
- load `llms-full.txt` only when narrower references cannot explain the behavior.
|
|
342
|
+
|
|
343
|
+
Primary reference: `docs/llms-full.txt` troubleshooting section.
|
|
344
|
+
|
|
345
|
+
## Maintainer-Only Skills
|
|
346
|
+
|
|
347
|
+
Do not ship these into user capsules by default:
|
|
348
|
+
|
|
349
|
+
- control-plane deploy;
|
|
350
|
+
- operator dashboard;
|
|
351
|
+
- account grant/revoke;
|
|
352
|
+
- backend contract implementation;
|
|
353
|
+
- Cloudflare/Turso/R2 provisioning internals;
|
|
354
|
+
- package publishing.
|
|
355
|
+
|
|
356
|
+
Those workflows belong in maintainer skills inside the AgentKit repository, not in generated user capsules.
|
|
357
|
+
|
|
358
|
+
Suggested maintainer skills:
|
|
359
|
+
|
|
360
|
+
```txt
|
|
361
|
+
skills/agentkit-maintainer-control-plane/
|
|
362
|
+
skills/agentkit-maintainer-channels/
|
|
363
|
+
skills/agentkit-maintainer-release/
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
## Generated Capsule Shape
|
|
367
|
+
|
|
368
|
+
V1 generated capsules should contain:
|
|
369
|
+
|
|
370
|
+
```txt
|
|
371
|
+
AGENTS.md
|
|
372
|
+
AGENTKIT.md
|
|
373
|
+
CLAUDE.md
|
|
374
|
+
README.md
|
|
375
|
+
skills/
|
|
376
|
+
agentkit-capsule/
|
|
377
|
+
SKILL.md
|
|
378
|
+
references/
|
|
379
|
+
docs-router.md
|
|
380
|
+
agentkit-build-agent/
|
|
381
|
+
SKILL.md
|
|
382
|
+
templates/
|
|
383
|
+
support-agent.instructions.md
|
|
384
|
+
appointment-intake.instructions.md
|
|
385
|
+
agentkit-prompts/
|
|
386
|
+
SKILL.md
|
|
387
|
+
templates/
|
|
388
|
+
support-agent.instructions.md
|
|
389
|
+
knowledge-grounded-faq.instructions.md
|
|
390
|
+
agentkit-tools/
|
|
391
|
+
SKILL.md
|
|
392
|
+
examples/
|
|
393
|
+
lookup-order.tool.ts
|
|
394
|
+
database-write.tool.ts
|
|
395
|
+
eval-safe-external-action.tool.ts
|
|
396
|
+
agentkit-database/
|
|
397
|
+
SKILL.md
|
|
398
|
+
templates/
|
|
399
|
+
appointments.schema.sql
|
|
400
|
+
leads.schema.sql
|
|
401
|
+
agentkit-evals/
|
|
402
|
+
SKILL.md
|
|
403
|
+
templates/
|
|
404
|
+
smoke.eval.ts
|
|
405
|
+
tool-call.eval.ts
|
|
406
|
+
agentkit-deploy/
|
|
407
|
+
SKILL.md
|
|
408
|
+
agentkit-security/
|
|
409
|
+
SKILL.md
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
Channel, Knowledge, provider, and troubleshooting skills are copied into every generated capsule. Since skills are context-lazy, the main tradeoff is filesystem size, not context usage.
|
|
413
|
+
|
|
414
|
+
## Handoff Changes
|
|
415
|
+
|
|
416
|
+
Change generated `AGENTS.md` and `AGENTKIT.md` from:
|
|
417
|
+
|
|
418
|
+
```txt
|
|
419
|
+
Read AGENTKIT.md and the full docs path from npm run agentkit -- docs full.
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
To:
|
|
423
|
+
|
|
424
|
+
```txt
|
|
425
|
+
Start with skills/agentkit-capsule/SKILL.md.
|
|
426
|
+
Use npm run agentkit -- docs llms as the docs router.
|
|
427
|
+
Read npm run agentkit -- docs full only when a skill tells you the complete contract is needed.
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
Change `agentkit handoff codex|claude` so it points to:
|
|
431
|
+
|
|
432
|
+
```txt
|
|
433
|
+
Read these files first:
|
|
434
|
+
- AGENTKIT.md
|
|
435
|
+
- skills/agentkit-capsule/SKILL.md
|
|
436
|
+
- the path printed by npm run agentkit -- docs llms
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
It should not include the concrete `llms-full.txt` path by default. It may mention that `llms-full.txt` exists for complete-contract checks.
|
|
440
|
+
|
|
441
|
+
## CLI Packaging
|
|
442
|
+
|
|
443
|
+
Keep the first version simple:
|
|
444
|
+
|
|
445
|
+
```sh
|
|
446
|
+
agentkit new <name> --template blank
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
The generated capsule receives the default skill pack automatically. Add `agentkit skills list/install` later only if users need to refresh or extend skill packs in existing capsules.
|
|
450
|
+
|
|
451
|
+
## Acceptance Criteria
|
|
452
|
+
|
|
453
|
+
The skills architecture is working when:
|
|
454
|
+
|
|
455
|
+
- a new capsule contains a `skills/` directory;
|
|
456
|
+
- `AGENTS.md` points to `skills/agentkit-capsule/SKILL.md`;
|
|
457
|
+
- `agentkit handoff codex` points to the skill router and `docs llms`, not `llms-full.txt`;
|
|
458
|
+
- ordinary prompt/tool/database tasks do not require loading `llms-full.txt`;
|
|
459
|
+
- each skill has focused verification commands;
|
|
460
|
+
- examples and templates live beside skills and are loaded only when needed;
|
|
461
|
+
- docs remain canonical and tests still verify packaged docs sync;
|
|
462
|
+
- user capsules do not include maintainer/operator skills by default.
|
|
463
|
+
|
|
464
|
+
## Rollout Plan
|
|
465
|
+
|
|
466
|
+
1. Add the default skill pack under `packages/agentkit/src/templates/skills` or another package-owned source directory.
|
|
467
|
+
2. Update `blank`, `support`, and `dentista` templates to copy the skill pack.
|
|
468
|
+
3. Update generated `AGENTS.md`, `AGENTKIT.md`, and `CLAUDE.md` to prefer skills and `docs llms`.
|
|
469
|
+
4. Update `agentkit handoff` to prefer the skill router.
|
|
470
|
+
5. Add tests that generated capsules contain the default skills and no longer nudge default handoff to `llms-full.txt`.
|
|
471
|
+
6. Keep `agentkit docs full` available for complete-contract audits.
|
|
@@ -81,6 +81,7 @@ Zapster smoke requires `ZAPSTER_API_KEY`, `AGENTKIT_ZAPSTER_SEND_URL`, and `AGEN
|
|
|
81
81
|
- Invalid Telegram/Zapster signature returns `401` and creates a failed delivery.
|
|
82
82
|
- Duplicate provider event returns `200` with `duplicate` and creates no second queue job.
|
|
83
83
|
- Accepted inbound text creates one queue job and one outbound delivery.
|
|
84
|
+
- Buffered inbound bursts stay in `buffered` state, then flush into one queue job and one outbound delivery.
|
|
84
85
|
- Retryable failures dead-letter after the configured retry ceiling.
|
|
85
86
|
- `channel_limit_exceeded` does not create queue backlog.
|
|
86
87
|
|
|
@@ -94,6 +95,7 @@ Zapster smoke requires `ZAPSTER_API_KEY`, `AGENTKIT_ZAPSTER_SEND_URL`, and `AGEN
|
|
|
94
95
|
## Production Defaults
|
|
95
96
|
|
|
96
97
|
- Start with conservative per-channel daily message and cost limits.
|
|
98
|
+
- For WhatsApp and Telegram agents that receive rapid client message bursts, start with `buffer.mode: "debounce"`, `quietWindowMs` between `1500` and `2500`, `maxWaitMs` between `8000` and `12000`, and strict `maxMessages`/`maxChars`.
|
|
97
99
|
- Keep raw body storage disabled unless there is an explicit encrypted R2 retention policy.
|
|
98
100
|
- Delivery APIs return hashes and redacted metadata, not payload bodies.
|
|
99
101
|
- Turso remains reserved for the user's agent application data, not AgentKit channel plumbing.
|