diff --git a/packages/agent/package.json b/packages/agent/package.json
index 684d1708..ba980b1c 100644
--- a/packages/agent/package.json
+++ b/packages/agent/package.json
@@ -23,6 +23,7 @@
"jsdom": "^27.4.0",
"toml": "^3.0.0",
"turndown": "^7.2.2",
+ "yaml": "^2.8.2",
"zod": "^4.3.6"
}
}
diff --git a/packages/agent/src/prompts/schedule.ts b/packages/agent/src/prompts/schedule.ts
index 756612f0..5eaa5a48 100644
--- a/packages/agent/src/prompts/schedule.ts
+++ b/packages/agent/src/prompts/schedule.ts
@@ -1,4 +1,5 @@
import { Schedule } from '../types'
+import { stringify } from 'yaml'
export interface ScheduleParams {
schedule: Schedule
@@ -9,14 +10,13 @@ export const schedule = (params: ScheduleParams) => {
const headers = {
'schedule-name': params.schedule.name,
'schedule-description': params.schedule.description,
- 'schedule-id': params.schedule.id,
'max-calls': params.schedule.maxCalls ?? 'Unlimited',
'cron-pattern': params.schedule.pattern,
}
return `
** This is a scheduled task automatically send to you by the system **
---
-${Bun.YAML.stringify(headers)}
+${stringify(headers)}
---
${params.schedule.command}
diff --git a/packages/agent/src/prompts/subagent.ts b/packages/agent/src/prompts/subagent.ts
index f642cb6c..0c2f464d 100644
--- a/packages/agent/src/prompts/subagent.ts
+++ b/packages/agent/src/prompts/subagent.ts
@@ -1,3 +1,5 @@
+import { stringify } from 'yaml'
+
export interface SubagentParams {
date: Date
name: string
@@ -10,13 +12,10 @@ export const subagentSystem = ({ date, name, description }: SubagentParams) => {
'description': description,
'time-now': date.toISOString(),
}
- return `
----
-${Bun.YAML.stringify(headers)}
----
-
-You are a subagent, which is a specialized assistant for a specific task.
-
-Your task is communicated with the master agent to complete a task.
-`
+ return [
+ description,
+ '---'
+ + stringify(headers)
+ + '---'
+ ].join('\n\n')
}
\ No newline at end of file
diff --git a/packages/agent/src/prompts/system.ts b/packages/agent/src/prompts/system.ts
index a6dea358..2789b82e 100644
--- a/packages/agent/src/prompts/system.ts
+++ b/packages/agent/src/prompts/system.ts
@@ -1,5 +1,6 @@
import { block, quote } from './utils'
import { AgentSkill, InboxItem } from '../types'
+import { stringify } from 'yaml'
export interface SystemParams {
date: Date
@@ -69,9 +70,9 @@ export const system = ({
return `
---
-${Bun.YAML.stringify(staticHeaders)}
+${stringify(staticHeaders)}
---
-You are an AI agent, and now you wake up.
+You are just woke up.
${quote('/data')} is your HOME — you can read and write files there freely.
@@ -94,10 +95,29 @@ Use ${quote('search_memory')} to recall earlier conversations beyond the current
- ${quote('send')}: send a message to a channel target. Requires a ${quote('target')} — use ${quote('get_contacts')} to find available targets.
- ${quote('react')}: add or remove an emoji reaction on a message
+Use message tools when:
+- Schedule tasks are triggered.
+- You need to send a message to other channels.
+- You want to reply or react an inbox message.
+
+Do not:
+- Use message tools to respond to the user directly
+
## Contacts
You may receive messages from different people, bots, and channels. Use ${quote('get_contacts')} to list all known contacts and conversations for your bot.
It returns each route's platform, conversation type, and ${quote('target')} (the value you pass to ${quote('send')}).
+## Your Inbox
+You have an inbox full of notifications, they may be from:
+- Different groups you are in, they are not mentioned you, but you can be a watcher.
+- Other platforms you are connected to, like email, etc.
+
+Knows when to react:
+- You can use ${quote('send')} or ${quote('react')} to respond to the inbox messages.
+- But remember, Not all messages are needed to be responded to.
+- Chat like a human, reply your interesting message.
+- Sometimes, an emoji reaction is better than a long text.
+
## Attachments
**Receiving**: Uploaded files are saved to your workspace; the file path appears in the message header.
@@ -119,6 +139,25 @@ Rules:
- No extra text inside ${quote('...')}
- The block can appear anywhere in your response; it will be parsed and stripped from visible text
+## Schedule Tasks
+
+You can create and manage schedule tasks via cron.
+Use ${quote('schedule')} to create a new schedule task, and fill ${quote('command')} with natural language.
+When cron pattern is valid, you will receive a schedule mesasage with your ${quote('command')}.
+
+Using ${quote('send')} to respond is a better way than responding directly.
+
+## Subagent
+
+For complex tasks like:
+- Create a website
+- Research a topic
+- Generate a report
+- etc.
+
+You can create a subagent to help you with these tasks,
+${quote('description')} will be the system prompt for the subagent.
+
## Skills
${skills.length} skills available via ${quote('use_skill')}:
${skills.map(skill => `- ${skill.name}: ${skill.description}`).join('\n')}
@@ -139,11 +178,9 @@ ${enabledSkills.map(skill => skillPrompt(skill)).join('\n\n---\n\n')}
${formatInbox(inbox)}
-## Session Context
-
----
-${Bun.YAML.stringify(dynamicHeaders)}
----
+
+${stringify(dynamicHeaders)}
+
Context window covers the last ${maxContextLoadTime} minutes (${(maxContextLoadTime / 60).toFixed(2)} hours).
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index ade02e89..66315fc1 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -142,6 +142,9 @@ importers:
typescript:
specifier: ^5
version: 5.9.3
+ yaml:
+ specifier: ^2.8.2
+ version: 2.8.2
zod:
specifier: ^4.3.6
version: 4.3.6