Start Chat
Use this skill when the user wants a script that opens Agent Chat, continues a chat, injects typed context parts, checks streaming, or deletes/focuses chats.
Write Here
~/.scriptkit/plugins/main/scripts/<name>.ts
Canonical Agent Chat SDK Flow
import "@scriptkit/sdk";
const result = await aiStartChat("Summarize this context", {
systemPrompt: "Be concise",
modelId: "claude-3-5-sonnet-20241022",
parts: [
{ kind: "resourceUri", uri: "kit://context?profile=minimal", label: "Current Context" },
],
});
await aiSendMessage(result.chatId, "Now inspect this file", undefined, [
{ kind: "filePath", path: "/tmp/example.rs", label: "example.rs" },
]);
const status = await aiGetStreamingStatus(result.chatId);
await aiFocus();
if (!status.isStreaming) {
await aiDeleteChat(result.chatId, false);
}
Use These Functions
aiStartChat() — start a new Agent Chat thread
aiSendMessage() — continue an existing thread
aiAppendMessage() — seed history without triggering a response
aiOn() — subscribe to streaming events
aiGetStreamingStatus() — poll stream state
aiFocus() — bring Agent Chat forward
aiDeleteChat() — soft-delete or permanently delete a chat
Context Parts
Supported parts entries:
{ kind: "resourceUri", uri, label }
{ kind: "filePath", path, label }
Use kit://context?profile=minimal for current desktop context.
Common Pitfalls
- Use Agent Chat SDK functions for programmatic chat workflows. Use prompt-level
chat() only for inline prompt UIs.
parts are typed attachments, not free-form text blobs.
- Do not invent Notes globals or screenshot globals here.
Related Examples
- Canonical:
~/.scriptkit/plugins/examples/scriptlets/agent_chat-chat/main.md — start chats, attach typed context parts, and inspect streaming status
- Compatibility mirror:
~/.scriptkit/plugins/examples/scriptlets/agent_chat-chat.md — auto-generated flat copy of the canonical source
Related Skills
- add-actions — expose Agent Chat helpers through the Actions Menu
- manage-notes — hand off note content into Agent Chat
- new-scriptlet — package Agent Chat helpers as scriptlet bundles
1---2name: start-chat3description: Start and manage Agent Chat conversations from scripts, including typed context parts, streaming status, and chat lifecycle operations.4---56# Start Chat78Use this skill when the user wants a script that opens Agent Chat, continues a chat, injects typed context parts, checks streaming, or deletes/focuses chats.910## Write Here1112`~/.scriptkit/plugins/main/scripts/<name>.ts`1314## Canonical Agent Chat SDK Flow1516```typescript17import "@scriptkit/sdk";1819const result = await aiStartChat("Summarize this context", {20 systemPrompt: "Be concise",21 modelId: "claude-3-5-sonnet-20241022",22 parts: [23 { kind: "resourceUri", uri: "kit://context?profile=minimal", label: "Current Context" },24 ],25});2627await aiSendMessage(result.chatId, "Now inspect this file", undefined, [28 { kind: "filePath", path: "/tmp/example.rs", label: "example.rs" },29]);3031const status = await aiGetStreamingStatus(result.chatId);32await aiFocus();3334if (!status.isStreaming) {35 await aiDeleteChat(result.chatId, false);36}37```3839## Use These Functions4041- `aiStartChat()` — start a new Agent Chat thread42- `aiSendMessage()` — continue an existing thread43- `aiAppendMessage()` — seed history without triggering a response44- `aiOn()` — subscribe to streaming events45- `aiGetStreamingStatus()` — poll stream state46- `aiFocus()` — bring Agent Chat forward47- `aiDeleteChat()` — soft-delete or permanently delete a chat4849## Context Parts5051Supported `parts` entries:5253- `{ kind: "resourceUri", uri, label }`54- `{ kind: "filePath", path, label }`5556Use `kit://context?profile=minimal` for current desktop context.5758## Common Pitfalls5960- Use Agent Chat SDK functions for programmatic chat workflows. Use prompt-level `chat()` only for inline prompt UIs.61- `parts` are typed attachments, not free-form text blobs.62- Do not invent Notes globals or screenshot globals here.6364## Related Examples6566- **Canonical**: `~/.scriptkit/plugins/examples/scriptlets/agent_chat-chat/main.md` — start chats, attach typed context parts, and inspect streaming status67- **Compatibility mirror**: `~/.scriptkit/plugins/examples/scriptlets/agent_chat-chat.md` — auto-generated flat copy of the canonical source6869## Related Skills7071- [add-actions](../add-actions/SKILL.md) — expose Agent Chat helpers through the Actions Menu72- [manage-notes](../manage-notes/SKILL.md) — hand off note content into Agent Chat73- [new-scriptlet](../new-scriptlet/SKILL.md) — package Agent Chat helpers as scriptlet bundles