You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: templates/_shared/agent-playbook.md.hbs
+21-9Lines changed: 21 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -14,19 +14,29 @@ Look for these markers:
14
14
15
15
{{#if (eqname"langchain")}}
16
16
1. Edit `app/system-prompt.md` to change agent behavior.
17
-
2. Change model choice in `app/agent.py`.
18
-
3. Extend schema in `app/models.py` if you need app-specific data.
19
-
4. Ensure `ARCADE_GATEWAY_URL` is set and the gateway has the expected tools.
17
+
2. The plan prompt is built inline in `app/routes/plan.py` (`_build_plan_prompt`) — update it to match your system prompt.
18
+
3. Change model choice in `app/agent.py`.
19
+
4. Extend schema in `app/models.py` if you need app-specific data.
20
+
5. Ensure `ARCADE_GATEWAY_URL` is set and the gateway has the expected tools.
21
+
6. If your agent needs write/mutation tools (send, create, reply, post, etc.) during planning, edit the `_MUTATION` regex in `app/routes/plan.py`. By default, all write tools are stripped from the plan endpoint to keep triage read-only.
20
22
{{elseif (eq name "mastra")}}
21
23
1. Edit `src/mastra/agents/system-prompt.md` to change agent behavior.
22
-
2. Change model choice in `src/mastra/agents/triage-agent.ts`.
23
-
3. Extend schema in `lib/db/schema.ts` if you need app-specific data.
24
-
4. Ensure `ARCADE_GATEWAY_URL` is set and the gateway has the expected tools.
24
+
2. Edit `src/mastra/agents/plan-prompt.md` to match your updated system prompt — this controls the plan endpoint's behavior.
25
+
3. Change model choice in `src/mastra/agents/triage-agent.ts`.
26
+
4. Extend schema in `lib/db/schema.ts` if you need app-specific data.
27
+
5. Ensure `ARCADE_GATEWAY_URL` is set and the gateway has the expected tools.
28
+
6. If your agent needs write/mutation tools (send, create, reply, post, etc.) during planning, edit the `MUTATION` regex filter in `app/api/plan/route.ts`. By default, all write tools are stripped from the plan endpoint to keep triage read-only.
29
+
7. Update `components/dashboard/empty-state.tsx` to match your agent's purpose — replace "Ready to triage?" heading, the description text, and "Plan my day" button label.
30
+
8. Look for `CUSTOMIZATION POINT` markers in UI files for other safe edit zones.
25
31
{{else}}
26
32
1. Edit `lib/system-prompt.md` to change agent behavior.
27
-
2. Change model choice in `lib/agent.ts`.
28
-
3. Extend schema in `lib/db/schema.ts` if you need app-specific data.
29
-
4. Ensure `ARCADE_GATEWAY_URL` is set and the gateway has the expected tools.
33
+
2. Edit `lib/plan-prompt.md` to match your updated system prompt — this controls the plan endpoint's behavior.
34
+
3. Change model choice in `lib/agent.ts`.
35
+
4. Extend schema in `lib/db/schema.ts` if you need app-specific data.
36
+
5. Ensure `ARCADE_GATEWAY_URL` is set and the gateway has the expected tools.
37
+
6. If your agent needs write/mutation tools (send, create, reply, post, etc.) during planning, edit the `MUTATION` regex filter in `app/api/plan/route.ts`. By default, all write tools are stripped from the plan endpoint to keep triage read-only.
38
+
7. Update `components/dashboard/empty-state.tsx` to match your agent's purpose — replace "Ready to triage?" heading, the description text, and "Plan my day" button label.
39
+
8. Look for `CUSTOMIZATION POINT` markers in UI files for other safe edit zones.
30
40
{{/if}}
31
41
32
42
## Gateway Checklist
@@ -39,6 +49,8 @@ Create/configure your gateway at `https://app.arcade.dev/mcp-gateways` and add:
39
49
- GitHub
40
50
- Gmail
41
51
52
+
If you add tools from services not listed above, also add a source entry in `lib/sources.ts` so they get proper icons and labels in the UI.
Copy file name to clipboardExpand all lines: templates/_shared/partials/customization.md.hbs
+14-4Lines changed: 14 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -3,11 +3,11 @@
3
3
### Change the agent's purpose
4
4
5
5
{{#if (eqname"mastra")}}
6
-
Edit `src/mastra/agents/system-prompt.md` to change what the agent does (PR reviews, calendar management, email drafting, etc.). The agent definition in `src/mastra/agents/triage-agent.ts` has `// --- CUSTOMIZATION POINT ---` markers for model selection and other settings.
6
+
Edit `src/mastra/agents/system-prompt.md` to change what the agent does (PR reviews, calendar management, email drafting, etc.). Also update `src/mastra/agents/plan-prompt.md` in the same directory — this is the system prompt for the plan/triage endpoint and must stay in sync with your main system prompt. The agent definition in `src/mastra/agents/triage-agent.ts` has `// --- CUSTOMIZATION POINT ---` markers for model selection and other settings.
7
7
{{elseif (eq name "ai-sdk")}}
8
-
Edit `lib/system-prompt.md` to change what the agent does (PR reviews, calendar management, email drafting, etc.). The agent configuration in `lib/agent.ts` has model selection you can customize.
8
+
Edit `lib/system-prompt.md` to change what the agent does (PR reviews, calendar management, email drafting, etc.). Also update `lib/plan-prompt.md` — this is the system prompt for the plan/triage endpoint and must stay in sync with your main system prompt. The agent configuration in `lib/agent.ts` has model selection you can customize.
9
9
{{else}}
10
-
Edit `app/system-prompt.md` to change what the agent does (PR reviews, calendar management, email drafting, etc.). The agent configuration in `app/agent.py` has `# --- CUSTOMIZATION POINT ---` markers for model selection and other settings.
10
+
Edit `app/system-prompt.md` to change what the agent does (PR reviews, calendar management, email drafting, etc.). The plan prompt is built inline in `app/routes/plan.py` — update `_build_plan_prompt()` to match your system prompt changes. The agent configuration in `app/agent.py` has `# --- CUSTOMIZATION POINT ---` markers for model selection and other settings.
11
11
{{/if}}
12
12
13
13
### Add or change Arcade tools
@@ -16,7 +16,7 @@ Edit `app/system-prompt.md` to change what the agent does (PR reviews, calendar
16
16
2. Add tools to your gateway (Gmail, GitHub, Google Calendar, etc.)
17
17
3. Update `ARCADE_GATEWAY_URL` in `.env` if needed
18
18
19
-
The agent automatically discovers all tools available on your gateway.
19
+
The agent automatically discovers all tools available on your gateway. Write tools (send, create, reply, etc.) may require additional OAuth authorization beyond read tools. The app handles this automatically — when a write tool needs auth, users see an inline prompt to grant access.
20
20
21
21
### Switch LLM provider
22
22
@@ -51,6 +51,16 @@ alembic upgrade head
51
51
```
52
52
{{/if}}
53
53
54
+
{{#if (eqlanguage"typescript")}}
55
+
### Customize the UI
56
+
57
+
The default UI is built for a daily triage workflow. To adapt it for your agent:
58
+
59
+
1. Edit `components/dashboard/empty-state.tsx` — change the heading, description, and button label
60
+
2. The dashboard layout in `app/dashboard/page.tsx` uses task cards and stats — you can restructure this for your use case
61
+
3. Look for `CUSTOMIZATION POINT` comments in UI files for safe edit zones
62
+
63
+
{{/if}}
54
64
### Production considerations
55
65
56
66
This template uses app-level token storage — all users share the same Arcade Gateway connection via a single `.arcade-auth/` directory. For production deployments:
|`lib/plan-prompt.md`| Plan endpoint system prompt (customize alongside system-prompt.md) |
46
+
|`app/api/plan/route.ts`| Plan/triage streaming endpoint — filters out write tools by default |
47
+
|`lib/sources.ts`| Tool-to-icon/label mapping — add entries for new services (has CUSTOMIZATION POINT marker) |
48
+
|`components/dashboard/empty-state.tsx`| Empty state UI — customize heading, description, and button for your agent's purpose |
45
49
46
50
## Auth Architecture
47
51
48
52
Three layers:
49
53
50
54
1.**App auth** — email/password via [Better Auth](https://www.better-auth.com), session cookies (7-day), SQLite storage via Drizzle adapter. Configure `BETTER_AUTH_SECRET` and `BETTER_AUTH_URL` in `.env`.
3.**Tool-level OAuth** — Arcade handles per-tool auth (Slack, GitHub, etc.); auth URLs surfaced in chat UI. Write tools (send, create, update, etc.) may require additional OAuth scopes beyond read permissions. When a write tool needs authorization, the plan route emits an `auth_required` event with an auth URL, and the UI shows an inline auth prompt. This flow is handled automatically — just ensure your UI renders the `AuthPrompt` component.
53
57
4.**Custom verifier** (optional) — `/api/auth/arcade/verify` confirms user identity for COAT protection. Enabling requires: (a) custom OAuth apps registered with each provider (Slack, GitHub, etc.) in the Arcade dashboard — default shared apps cannot be used, and (b) exposing the local server via ngrok so Arcade can reach the endpoint. When using ngrok: set `NEXT_PUBLIC_APP_URL` to the ngrok URL, delete `.arcade-auth/`, restart the dev server, and **log in via the ngrok URL** (not localhost) — session cookies are scoped to the host that sets them; mismatched host = silent verification failure (`verify_session_required` error). If you get repeated `400 Bad Request` from Arcade's `confirm_user` API, the `flow_id` is stale — delete `.arcade-auth/`, restart, re-authenticate, then retry tool auth from scratch.
54
58
55
59
## Constraints
@@ -62,6 +66,7 @@ Three layers:
62
66
## Customization Points
63
67
64
68
-`lib/system-prompt.md` — Agent purpose and behavior
69
+
-`lib/plan-prompt.md` — Plan endpoint system prompt (keep in sync with system-prompt.md)
65
70
-`lib/agent.ts` — Model selection
66
71
-`lib/db/schema.ts` — Database schema
67
72
@@ -70,6 +75,6 @@ Three layers:
70
75
-**Main UI**: `app/dashboard/page.tsx` — layout, plan-run flow, and ChatPanel toggle. This is the primary entry point after login.
71
76
-**Component library**: import UI components from `@arcadeai/design-system`; import brand icons (Slack, GitHub, Gmail, etc.) from `@arcadeai/design-system/components/ui/atoms/icons`.
72
77
-**Startup checks**: add new env-var warnings in `app/api/health/route.ts` — push a new `ConfigWarning` object to the `warnings` array.
73
-
-**Safe to edit**: `lib/system-prompt.md`, `lib/agent.ts` (model choice), `lib/db/schema.ts` (schema extensions).
74
-
-**Edit with care**: anything under `app/api/auth/arcade/` — the OAuth flow is stateful (PKCE verifier, token exchange, `.arcade-auth/` persistence). Read the full flow before making changes.
78
+
-**Safe to edit**: `lib/system-prompt.md`, `lib/plan-prompt.md`, `lib/agent.ts` (model choice), `lib/db/schema.ts` (schema extensions), `lib/sources.ts` (add source entries for new toolkits), `components/dashboard/empty-state.tsx` (heading, description, button label).
79
+
-**Edit with care**: anything under `app/api/auth/arcade/` — the OAuth flow is stateful (PKCE verifier, token exchange, `.arcade-auth/` persistence). Read the full flow before making changes.`app/api/plan/route.ts` — contains a `MUTATION` regex that strips write tools (create, send, reply, etc.) from the plan endpoint. If your agent needs write tools during planning, update or remove this filter.
75
80
-**Do not touch**: `lib/arcade.ts` unless you understand the `OAuthClientProvider` contract expected by `@ai-sdk/mcp`.
3.**Tool-level OAuth** — Arcade handles per-tool auth (Slack, GitHub, etc.); auth URLs surfaced in chat UI. Write tools (send, create, reply, etc.) may require additional OAuth authorization beyond read tools. The app handles this automatically — when a write tool needs auth, users see an inline prompt to grant access.
51
52
4.**Custom verifier** (optional) — `/api/arcade/verify` confirms user identity for COAT protection. Enabling the custom verifier also requires: (a) setting up custom OAuth applications with each auth provider (Slack, GitHub, etc.) in the Arcade dashboard — Arcade's default shared OAuth apps cannot be used with a custom verifier, and (b) exposing the local dev server via ngrok (`ngrok http 8000`) so Arcade can reach the verifier endpoint, then configuring the ngrok URL in the Arcade dashboard
0 commit comments