Skip to content

Commit f1b0b34

Browse files
teallarsonclaude
andauthored
Document more customization points across all templates (#30)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6059c6a commit f1b0b34

6 files changed

Lines changed: 93 additions & 58 deletions

File tree

templates/_shared/agent-playbook.md.hbs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,29 @@ Look for these markers:
1414

1515
{{#if (eq name "langchain")}}
1616
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.
2022
{{else if (eq name "mastra")}}
2123
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.
2531
{{else}}
2632
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.
3040
{{/if}}
3141

3242
## Gateway Checklist
@@ -39,6 +49,8 @@ Create/configure your gateway at `https://app.arcade.dev/mcp-gateways` and add:
3949
- GitHub
4050
- Gmail
4151

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.
53+
4254
## Verification Commands
4355

4456
{{#if (eq name "langchain")}}

templates/_shared/nextjs-ui/components/dashboard/empty-state.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ export function EmptyState({ onPlan, loading }: EmptyStateProps) {
1313
<div className="flex flex-1 flex-col items-center justify-center gap-6 p-8">
1414
<Inbox size={48} className="text-muted-foreground/50" />
1515
<div className="flex flex-col items-center gap-2">
16+
{/* CUSTOMIZATION POINT — empty state heading */}
1617
<h2 className="text-2xl font-semibold">Ready to triage?</h2>
18+
{/* CUSTOMIZATION POINT — empty state description */}
1719
<p className="max-w-md text-center text-muted-foreground">
1820
Your agent will scan your inbox, calendar, tasks, and PRs, then prioritize everything and
1921
build your action plan.
@@ -26,6 +28,7 @@ export function EmptyState({ onPlan, loading }: EmptyStateProps) {
2628
Planning...
2729
</>
2830
) : (
31+
/* CUSTOMIZATION POINT — primary action button label */
2932
"Plan my day"
3033
)}
3134
</Button>

templates/_shared/partials/customization.md.hbs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
### Change the agent's purpose
44

55
{{#if (eq name "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.
77
{{else if (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.
99
{{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.
1111
{{/if}}
1212

1313
### Add or change Arcade tools
@@ -16,7 +16,7 @@ Edit `app/system-prompt.md` to change what the agent does (PR reviews, calendar
1616
2. Add tools to your gateway (Gmail, GitHub, Google Calendar, etc.)
1717
3. Update `ARCADE_GATEWAY_URL` in `.env` if needed
1818

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.
2020

2121
### Switch LLM provider
2222

@@ -51,6 +51,16 @@ alembic upgrade head
5151
```
5252
{{/if}}
5353

54+
{{#if (eq language "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}}
5464
### Production considerations
5565

5666
This template uses app-level token storage — all users share the same Arcade Gateway connection via a single `.arcade-auth/` directory. For production deployments:

templates/ai-sdk/CLAUDE.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,31 @@ bunx drizzle-kit migrate # Run migrations
2929

3030
## Key Files
3131

32-
| File | Purpose |
33-
| --------------------------------------- | ------------------------------------------------------ |
34-
| `lib/agent.ts` | Model selection (Claude/GPT-4o) + system prompt loader |
35-
| `lib/system-prompt.md` | System prompt (customization point) |
36-
| `lib/arcade.ts` | MCP OAuth provider + `createMCPClient` factory |
37-
| `app/api/chat/route.ts` | Streaming chat endpoint (`streamText` + MCP tools) |
38-
| `app/api/auth/arcade/connect/route.ts` | Pre-flight Arcade connection check |
39-
| `app/api/auth/arcade/callback/route.ts` | OAuth callback (code → tokens) |
40-
| `app/api/auth/arcade/verify/route.ts` | Custom user verifier (COAT protection) |
41-
| `app/dashboard/page.tsx` | Daily triage dashboard (main UI entry point) |
42-
| `lib/auth.ts` | Better Auth server config + `getSession()` helper |
43-
| `lib/auth-client.ts` | Better Auth React client (signIn, signUp, signOut) |
44-
| `lib/db/schema.ts` | Database schema (Better Auth tables + custom tables) |
32+
| File | Purpose |
33+
| --------------------------------------- | ------------------------------------------------------------------------------------------ |
34+
| `lib/agent.ts` | Model selection (Claude/GPT-4o) + system prompt loader |
35+
| `lib/system-prompt.md` | System prompt (customization point) |
36+
| `lib/arcade.ts` | MCP OAuth provider + `createMCPClient` factory |
37+
| `app/api/chat/route.ts` | Streaming chat endpoint (`streamText` + MCP tools) |
38+
| `app/api/auth/arcade/connect/route.ts` | Pre-flight Arcade connection check |
39+
| `app/api/auth/arcade/callback/route.ts` | OAuth callback (code → tokens) |
40+
| `app/api/auth/arcade/verify/route.ts` | Custom user verifier (COAT protection) |
41+
| `app/dashboard/page.tsx` | Daily triage dashboard (main UI entry point) |
42+
| `lib/auth.ts` | Better Auth server config + `getSession()` helper |
43+
| `lib/auth-client.ts` | Better Auth React client (signIn, signUp, signOut) |
44+
| `lib/db/schema.ts` | Database schema (Better Auth tables + custom tables) |
45+
| `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 |
4549

4650
## Auth Architecture
4751

4852
Three layers:
4953

5054
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`.
5155
2. **Arcade Gateway OAuth** — MCP OAuth flow with file-based token persistence in `.arcade-auth/` (discovery → registration → PKCE → token exchange)
52-
3. **Tool-level OAuth** — Arcade handles per-tool auth (Slack, GitHub, etc.); auth URLs surfaced in chat UI
56+
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.
5357
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.
5458

5559
## Constraints
@@ -62,6 +66,7 @@ Three layers:
6266
## Customization Points
6367

6468
- `lib/system-prompt.md` — Agent purpose and behavior
69+
- `lib/plan-prompt.md` — Plan endpoint system prompt (keep in sync with system-prompt.md)
6570
- `lib/agent.ts` — Model selection
6671
- `lib/db/schema.ts` — Database schema
6772

@@ -70,6 +75,6 @@ Three layers:
7075
- **Main UI**: `app/dashboard/page.tsx` — layout, plan-run flow, and ChatPanel toggle. This is the primary entry point after login.
7176
- **Component library**: import UI components from `@arcadeai/design-system`; import brand icons (Slack, GitHub, Gmail, etc.) from `@arcadeai/design-system/components/ui/atoms/icons`.
7277
- **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.
7580
- **Do not touch**: `lib/arcade.ts` unless you understand the `OAuthClientProvider` contract expected by `@ai-sdk/mcp`.

templates/langchain/CLAUDE.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,27 @@ alembic upgrade head # Run migrations
2828

2929
## Key Files
3030

31-
| File | Purpose |
32-
| ---------------------- | ------------------------------------------------------------------------ |
33-
| `app/agent.py` | Agent definition — model selection |
34-
| `app/system-prompt.md` | System prompt (customization point) |
35-
| `app/arcade_oauth.py` | MCP OAuth flow — discovery, PKCE, token exchange, file-based persistence |
36-
| `app/routes/chat.py` | SSE streaming chat endpoint |
37-
| `app/routes/arcade.py` | OAuth connect/callback + custom user verifier |
38-
| `app/routes/auth.py` | Login, register, logout |
39-
| `app/auth.py` | `get_current_user()` helper (FastAPI Users JWT-backed) |
40-
| `app/auth_manager.py` | FastAPI Users setup (UserManager, JWT strategy, cookie transport) |
41-
| `app/models.py` | User model (extends FastAPI Users base) |
42-
| `app/static/chat.js` | Chat UI — SSE streaming, tool calls, auth URLs |
31+
| File | Purpose |
32+
| ---------------------- | ---------------------------------------------------------------------------- |
33+
| `app/agent.py` | Agent definition — model selection |
34+
| `app/system-prompt.md` | System prompt (customization point) |
35+
| `app/arcade_oauth.py` | MCP OAuth flow — discovery, PKCE, token exchange, file-based persistence |
36+
| `app/routes/chat.py` | SSE streaming chat endpoint |
37+
| `app/routes/arcade.py` | OAuth connect/callback + custom user verifier |
38+
| `app/routes/auth.py` | Login, register, logout |
39+
| `app/auth.py` | `get_current_user()` helper (FastAPI Users JWT-backed) |
40+
| `app/auth_manager.py` | FastAPI Users setup (UserManager, JWT strategy, cookie transport) |
41+
| `app/models.py` | User model (extends FastAPI Users base) |
42+
| `app/static/chat.js` | Chat UI — SSE streaming, tool calls, auth URLs |
43+
| `app/routes/plan.py` | Plan/triage endpoint — filters out write tools + unknown services by default |
4344

4445
## Auth Architecture
4546

4647
Three layers:
4748

4849
1. **App auth** — email/password via [FastAPI Users](https://fastapi-users.github.io/fastapi-users/), stateless JWT stored in an httpOnly `session_id` cookie, SQLite storage. Configure `APP_SECRET_KEY` in `.env`.
4950
2. **Arcade Gateway OAuth** — MCP OAuth flow with file-based token persistence in `.arcade-auth/` (discovery → registration → PKCE → token exchange)
50-
3. **Tool-level OAuth** — Arcade handles per-tool auth (Slack, GitHub, etc.); auth URLs surfaced in chat UI
51+
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.
5152
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
5253

5354
## Constraints

0 commit comments

Comments
 (0)