Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

feat(web-studio): manage account memory extraction templates (#5495)

yufeng36fc7e203973
diff --git a/web-studio/src/i18n/locales/en.ts b/web-studio/src/i18n/locales/en.ts
index 1ab55e12e..3167309e6 100644
--- a/web-studio/src/i18n/locales/en.ts
+++ b/web-studio/src/i18n/locales/en.ts
@@ -4,6 +4,7 @@ import memoryPolicy from './en/user-memory-policy'
import workspace from './en/workspace'
import resources from './en/resources'
import activity from './en/activity'
+import memoryTemplates from './en/memory-templates'
const en = {
compile,
@@ -11,7 +12,7 @@ const en = {
...workspace,
...resources,
...activity,
- settings: { ...workspace.settings, memoryPolicy },
+ settings: { ...workspace.settings, memoryPolicy, memoryTemplates },
} as const
export default en
diff --git a/web-studio/src/i18n/locales/en/memory-templates.ts b/web-studio/src/i18n/locales/en/memory-templates.ts
new file mode 100644
index 000000000..58990764b
--- /dev/null
+++ b/web-studio/src/i18n/locales/en/memory-templates.ts
@@ -0,0 +1,101 @@
+export default {
+ tab: 'Extraction rules',
+ title: 'Memory extraction rules',
+ subtitle:
+ 'Configure extraction instructions for memory types and fields in this account. New rules apply to future extraction.',
+ account: 'Current account: {{account}}',
+ fileName: '{{type}}.md',
+ userGroup: 'User context',
+ userGroupHint:
+ 'Remember who the user is, what matters to them, and what happened',
+ agentGroup: 'Agent identity and continuity',
+ agentGroupHint:
+ 'Keep the assistant’s identity, boundaries, and expression consistent',
+ profile: 'Profile',
+ preferences: 'Preferences',
+ entities: 'Entities',
+ events: 'Events',
+ soul: 'Soul',
+ identity: 'Identity',
+ profileHint: 'Stable identity, background, and long-term context.',
+ preferencesHint: 'Preferences, dislikes, and habits organized by topic.',
+ entitiesHint:
+ 'Important people, organizations, places, products, and relationships.',
+ eventsHint:
+ 'Specific events, decisions, commitments, and outcomes worth recalling.',
+ soulHint:
+ 'The assistant’s enduring principles, boundaries, style, and continuity.',
+ identityHint: 'The assistant’s name, identity, style, and introduction.',
+ custom: 'Customized',
+ default: 'System default',
+ back: 'Back to extraction rules',
+ loading: 'Loading memory templates…',
+ retry: 'Retry',
+ accessDenied:
+ 'Account administrator access is required to configure extraction rules.',
+ openConnection: 'Check connection settings',
+ typeDescription: 'Memory type description',
+ typeDescriptionHint:
+ 'Determines which information triggers extraction or an update.',
+ fieldDescription: 'Field extraction instruction',
+ contentTemplate: 'Memory file content template',
+ contentTemplateHint: 'Organizes extracted fields into the memory file body.',
+ edit: 'Configure rules',
+ cancel: 'Cancel',
+ save: 'Publish now',
+ saving: 'Saving…',
+ reset: 'Restore system default',
+ resetField: 'Restore default',
+ confirmReset:
+ 'All custom instructions for this type will return to system defaults. Existing memories will not be rewritten.',
+ confirm: 'Restore defaults',
+ saved: 'Extraction rules published',
+ resetDone: 'System defaults restored',
+ saveFailed: 'Save failed',
+ resetFailed: 'Reset failed',
+ required: 'Extraction instructions cannot be empty.',
+ tooLong: 'Each extraction instruction is limited to 50,000 characters.',
+ example: 'Example memory file',
+ exampleHint:
+ 'Path variables are filled when memory is generated; the example body is not generated from your edits.',
+ examples: {
+ profile:
+ '# User profile\n- Occupation: product designer\n- Communication: conclusions and evidence first\n- Long-term interest: knowledge management',
+ preferences:
+ '# Working style\n- Prefers concise conclusions first\n- Likes reproducible examples',
+ entities:
+ '# Example project\n- Type: project\n- Relationship: a product the user works on',
+ events:
+ '# An important decision\n- Date: 2026-08-19\n- Adopted a new workflow\n- Review its impact later',
+ soul: "# Assistant principles\n- Represent known facts accurately\n- Explain uncertainty\n- Respect the user's boundaries",
+ identity:
+ '# Assistant identity\n- Name: Example assistant\n- Style: clear and direct\n- Introduction: helps organize information and complete tasks',
+ },
+ variable: 'Available variable',
+ languageVariable: 'language +',
+ variableHint: 'Click to append to the current instruction',
+ syntax: 'Jinja syntax',
+ syntaxHint:
+ 'Descriptions support restricted Jinja expressions, validated by the server on save.',
+ syntaxExample: "{{ language or 'English' }} · {% if language %}…{% endif %}",
+ changed: 'Unsaved changes',
+ description: 'description',
+ fieldPath: 'fields.{{field}}.description',
+ contentPath: 'content_template',
+ fields: {
+ content: 'Profile body',
+ topic: 'Preference topic',
+ category: 'Entity category',
+ name: 'Name',
+ event_name: 'Event name',
+ summary: 'Event summary',
+ core_truths: 'Core principles',
+ boundaries: 'Boundaries',
+ vibe: 'Style',
+ continuity: 'Continuity',
+ creature: 'Identity concept',
+ avatar: 'Avatar',
+ emoji: 'Emoji',
+ introduction: 'Introduction',
+ },
+} as const
diff --git a/web-studio/src/i18n/locales/zh-CN.ts b/web-studio/src/i18n/locales/zh-CN.ts
index 23a5c8be5..9e7dcfeaf 100644
--- a/web-studio/src/i18n/locales/zh-CN.ts
+++ b/web-studio/src/i18n/locales/zh-CN.ts
@@ -4,6 +4,7 @@ import memoryPolicy from './zh-CN/user-memory-policy'
import workspace from './zh-CN/workspace'
import resources from './zh-CN/resources'
import activity from './zh-CN/activity'
+import memoryTemplates from './zh-CN/memory-templates'
const zhCN = {
compile,
@@ -11,7 +12,7 @@ const zhCN = {
...workspace,
...resources,
...activity,
- settings: { ...workspace.settings, memoryPolicy },
+ settings: { ...workspace.settings, memoryPolicy, memoryTemplates },
} as const
export default zhCN
diff --git a/web-studio/src/i18n/locales/zh-CN/memory-templates.ts b/web-studio/src/i18n/locales/zh-CN/memory-templates.ts
new file mode 100644
index 000000000..3bf4283d0
--- /dev/null
+++ b/web-studio/src/i18n/locales/zh-CN/memory-templates.ts
@@ -0,0 +1,91 @@
+export default {
+ tab: '抽取规则',
+ title: '记忆抽取规则',
+ subtitle:
+ '为当前账号设置记忆类型和字段的抽取说明。保存后,后续抽取使用新规则。',
+ account: '当前账号:{{account}}',
+ fileName: '{{type}}.md',
+ userGroup: 'User 环境与理解',
+ userGroupHint: '记录用户是谁、关注什么,以及发生过什么',
+ agentGroup: 'Agent 身份与连续性',
+ agentGroupHint: '保持助手的身份、边界和长期表达一致',
+ profile: 'Profile',
+ preferences: 'Preferences',
+ entities: 'Entities',
+ events: 'Events',
+ soul: 'Soul',
+ identity: 'Identity',
+ profileHint: '用户是谁:稳定身份、背景与长期状态的总览。',
+ preferencesHint: '用户喜欢、讨厌或习惯怎样做事,按主题沉淀。',
+ entitiesHint: '用户提及的重要人物、组织、地点、产品与关系。',
+ eventsHint: '值得未来回忆的具体事件、决定、承诺与结果。',
+ soulHint: '助手持续遵循的核心价值、边界、气质与连续性原则。',
+ identityHint: '助手的名字、身份设定、表达气质和自我介绍。',
+ custom: '已自定义',
+ default: '系统默认',
+ back: '返回抽取规则',
+ loading: '正在加载记忆模板…',
+ retry: '重新加载',
+ accessDenied: '需要当前账号的管理员权限才能配置抽取规则。',
+ openConnection: '检查连接设置',
+ typeDescription: '记忆类型描述',
+ typeDescriptionHint: '决定什么样的信息会触发此类记忆的抽取或更新。',
+ fieldDescription: '字段抽取说明',
+ contentTemplate: '记忆文件正文模板',
+ contentTemplateHint: '决定已抽取字段如何组织成记忆文件正文。',
+ edit: '配置策略',
+ cancel: '取消',
+ save: '立即生效',
+ saving: '正在保存…',
+ reset: '恢复系统默认',
+ resetField: '恢复默认',
+ confirmReset:
+ '恢复后,此类型的全部自定义说明都会改为系统默认值。已有记忆不会被重写。',
+ confirm: '确认恢复',
+ saved: '抽取规则已发布',
+ resetDone: '已恢复系统默认',
+ saveFailed: '保存失败',
+ resetFailed: '恢复失败',
+ required: '抽取说明不能为空。',
+ tooLong: '单项抽取说明最多 50000 个字符。',
+ example: '示例记忆文件',
+ exampleHint:
+ '路径中的模板变量会在生成记忆时填充;示例正文不会随编辑实时生成。',
+ examples: {
+ profile:
+ '# 用户画像\n- 职业:产品设计师\n- 沟通偏好:先看结论与依据\n- 长期关注:知识管理',
+ preferences: '# 工作方式\n- 喜欢先看简明结论\n- 偏好附有可复现的例子',
+ entities: '# 示例项目\n- 类型:项目\n- 与用户的关系:当前负责的产品',
+ events:
+ '# 一次重要决定\n- 时间:2026-08-19\n- 决定采用新的工作流程\n- 后续需要复盘效果',
+ soul: '# 助手原则\n- 准确表达已知事实\n- 说明不确定之处\n- 尊重用户设定的边界',
+ identity:
+ '# 助手身份\n- 名称:示例助手\n- 风格:清晰、直接\n- 自我介绍:帮助整理信息与完成任务',
+ },
+ variable: '可用变量',
+ languageVariable: 'language +',
+ variableHint: '点击插入到当前说明的末尾',
+ syntax: 'Jinja 语法说明',
+ syntaxHint: '说明字段支持受限的 Jinja 表达式;服务端会在保存时校验。',
+ syntaxExample: "{{ language or '中文' }} · {% if language %}…{% endif %}",
+ changed: '未保存的修改',
+ description: 'description',
+ fieldPath: 'fields.{{field}}.description',
+ contentPath: 'content_template',
+ fields: {
+ content: '用户画像正文',
+ topic: '偏好主题',
+ category: '实体分类',
+ name: '名称',
+ event_name: '事件名称',
+ summary: '事件摘要',
+ core_truths: '核心原则',
+ boundaries: '边界',
+ vibe: '表达气质',
+ continuity: '连续性',
+ creature: '身份设定',
+ avatar: '头像',
+ emoji: 'Emoji',
+ introduction: '自我介绍',
+ },
+} as const
diff --git a/web-studio/src/lib/admin.ts b/web-studio/src/lib/admin.ts
index 2409b3178..280eb0e7f 100644
--- a/web-studio/src/lib/admin.ts
+++ b/web-studio/src/lib/admin.ts
@@ -123,7 +123,7 @@ function setOptionalHeader(
}
}
-function createAdminClient(connection: AdminConnection) {
+export function createAdminClient(connection: AdminConnection) {
const headers: Record<string, string> = {
Accept: 'application/json',
}
diff --git a/web-studio/src/lib/memory-templates.test.ts b/web-studio/src/lib/memory-templates.test.ts
new file mode 100644
index 000000000..301e2fe77
--- /dev/null
+++ b/web-studio/src/lib/memory-templates.test.ts
@@ -0,0 +1,42 @@
+import { describe, expect, it } from 'vitest'
+import { templateFieldValue, withTemplateField } from './memory-templates'
+import type { MemoryTemplateSchema } from './memory-templates'
+
+const schema: MemoryTemplateSchema = {
+ memory_type: 'events',
+ description: 'Event extraction',
+ directory: 'viking://user/{{ user_space }}/memories/events',
+ filename_template:
+ '{{ extract_context.get_year(ranges) }}/{{ extract_context.get_month(ranges) }}/{{ extract_context.get_day(ranges) }}/{{ event_name }}.md',
+ enabled: true,
+ fields: [
+ { name: 'event_name', description: 'Name', merge_op: 'replace' },
+ { name: 'summary', description: 'Summary', merge_op: 'patch' },
+ ],
+ content_template: '{{ summary }}',
+}
+
+describe('memory template edits', () => {
+ it('changes only the selected description and preserves locked schema fields', () => {
+ const updated = withTemplateField(
+ schema,
+ 'fields.summary.description',
+ 'New summary rule',
+ )
+
+ expect(templateFieldValue(updated, 'fields.summary.description')).toBe(
+ 'New summary rule',
+ )
+ expect(updated.fields[0]).toEqual(schema.fields[0])
+ expect(updated.fields[1].merge_op).toBe('patch')
+ expect(updated.enabled).toBe(true)
+ expect(schema.fields[1].description).toBe('Summary')
+ })
+
+ it('updates a type description without dropping the other fields', () => {
+ const updated = withTemplateField(schema, 'description', 'New rule')
+ expect(updated.description).toBe('New rule')
+ expect(updated.fields).toEqual(schema.fields)
+ expect(updated.content_template).toBe('{{ summary }}')
+ })
+})
diff --git a/web-studio/src/lib/memory-templates.ts b/web-studio/src/lib/memory-templates.ts
new file mode 100644
index 000000000..1d3d37384
--- /dev/null
+++ b/web-studio/src/lib/memory-templates.ts
@@ -0,0 +1,99 @@
+import { getOvResult } from '#/lib/ov-client'
+import { createAdminClient } from '#/lib/admin'
+import type { AdminConnection } from '#/lib/admin'
+
+export const editableMemoryTypes = [
+ 'profile',
+ 'preferences',
+ 'entities',
+ 'events',
+ 'soul',
+ 'identity',
+] as const
+
+export type EditableMemoryType = (typeof editableMemoryTypes)[number]
+
+export type MemoryTemplateSchema = {
+ description: string
+ directory: string
+ filename_template: string
+ fields: Array<{ name: string; description: string; [key: string]: unknown }>
+ content_template?: string
+ [key: string]: unknown
+}
+
+export type MemoryTemplate = {
+ memory_type: EditableMemoryType
+ status: 'system_default' | 'custom'
+ updated_at: string | null
+ defaults: MemoryTemplateSchema
+ effective: MemoryTemplateSchema
+}
+
+const basePath = '/api/v1/admin/accounts/{account_id}/memory-templates'
+
+export async function fetchMemoryTemplates(connection: AdminConnection) {
+ return getOvResult<{ account_id: string; templates: MemoryTemplate[] }>(
+ createAdminClient(connection).get({
+ url: basePath,
+ path: { account_id: connection.accountId },
+ }),
+ )
+}
+
+export async function updateMemoryTemplate(
+ connection: AdminConnection,
+ memoryType: EditableMemoryType,
+ schema: MemoryTemplateSchema,
+) {
+ return getOvResult<{ account_id: string } & MemoryTemplate>(
+ createAdminClient(connection).put({
+ url: `${basePath}/{memory_type}`,
+ path: { account_id: connection.accountId, memory_type: memoryType },
+ headers: { 'Content-Type': 'application/json' },
+ body: schema,
+ }),
+ )
+}
+
+export async function resetMemoryTemplate(
+ connection: AdminConnection,
+ memoryType: EditableMemoryType,
+) {
+ return getOvResult<{ account_id: string } & MemoryTemplate>(
+ createAdminClient(connection).delete({
+ url: `${basePath}/{memory_type}`,
+ path: { account_id: connection.accountId, memory_type: memoryType },
+ }),
+ )
+}
+
+export function withTemplateField(
+ schema: MemoryTemplateSchema,
+ field: string,
+ value: string,
+): MemoryTemplateSchema {
+ if (field === 'description' || field === 'content_template') {
+ return { ...schema, [field]: value }
+ }
+ const fieldName = field.split('.')[1]
+ return {
+ ...schema,
+ fields: schema.fields.map((item) =>
+ item.name === fieldName ? { ...item, description: value } : item,
+ ),
+ }
+}
+
+export function templateFieldValue(
+ schema: MemoryTemplateSchema,
+ field: string,
+) {
+ if (field === 'description' || field === 'content_template') {
+ return String(schema[field] ?? '')
+ }
+ return (
+ schema.fields.find((item) => item.name === field.split('.')[1])
+ ?.description ?? ''
+ )
+}
diff --git a/web-studio/src/routeTree.gen.ts b/web-studio/src/routeTree.gen.ts
index f8a37355c..d26d418db 100644
--- a/web-studio/src/routeTree.gen.ts
+++ b/web-studio/src/routeTree.gen.ts
@@ -30,6 +30,7 @@ import { Route as SessionsIndexRouteImport } from './routes/sessions/index'
import { Route as CompileIndexRouteImport } from './routes/compile/index'
import { Route as AgentExperienceIndexRouteImport } from './routes/agent-experience/index'
import { Route as UsersPermissionsRouteImport } from './routes/users/permissions'
+import { Route as UsersMemoryTemplatesRouteImport } from './routes/users/memory-templates'
import { Route as UsersGroupsRouteImport } from './routes/users/groups'
import { Route as OauthVerifyRouteImport } from './routes/oauth/verify'
import { Route as OauthConsentRouteImport } from './routes/oauth/consent'
@@ -142,6 +143,11 @@ const UsersPermissionsRoute = UsersPermissionsRouteImport.update({
path: '/permissions',
getParentRoute: () => UsersRouteRoute,
} as any)
+const UsersMemoryTemplatesRoute = UsersMemoryTemplatesRouteImport.update({
+ id: '/memory-templates',
+ path: '/memory-templates',
+ getParentRoute: () => UsersRouteRoute,
+} as any)
const UsersGroupsRoute = UsersGroupsRouteImport.update({
id: '/groups',
path: '/groups',
@@ -195,6 +201,7 @@ export interface FileRoutesByFullPath {
'/oauth/consent': typeof OauthConsentRoute
'/oauth/verify': typeof OauthVerifyRoute
'/users/groups': typeof UsersGroupsRoute
+ '/users/memory-templates': typeof UsersMemoryTemplatesRoute
'/users/permissions': typeof UsersPermissionsRoute
'/agent-experience/': typeof AgentExperienceIndexRoute
'/compile/': typeof CompileIndexRoute
@@ -220,6 +227,7 @@ export interface FileRoutesByTo {
'/oauth/consent': typeof OauthConsentRoute
'/oauth/verify': typeof OauthVerifyRoute
'/users/groups': typeof UsersGroupsRoute
+ '/users/memory-templates': typeof UsersMemoryTemplatesRoute
'/users/permissions': typeof UsersPermissionsRoute
'/agent-experience': typeof AgentExperienceIndexRoute
'/compile': typeof CompileIndexRoute
@@ -250,6 +258,7 @@ export interface FileRoutesById {
'/oauth/consent': typeof OauthConsentRoute
'/oauth/verify': typeof OauthVerifyRoute
'/users/groups': typeof UsersGroupsRoute
+ '/users/memory-templates': typeof UsersMemoryTemplatesRoute
'/users/permissions': typeof UsersPermissionsRoute
'/agent-experience/': typeof AgentExperienceIndexRoute
'/compile/': typeof CompileIndexRoute
@@ -281,6 +290,7 @@ export interface FileRouteTypes {
| '/oauth/consent'
| '/oauth/verify'
| '/users/groups'
+ | '/users/memory-templates'
| '/users/permissions'
| '/agent-experience/'
| '/compile/'
@@ -306,6 +316,7 @@ export interface FileRouteTypes {
| '/oauth/consent'
| '/oauth/verify'
| '/users/groups'
+ | '/users/memory-templates'
| '/users/permissions'
| '/agent-experience'
| '/compile'
@@ -335,6 +346,7 @@ export interface FileRouteTypes {
| '/oauth/consent'
| '/oauth/verify'
| '/users/groups'
+ | '/users/memory-templates'
| '/users/permissions'
| '/agent-experience/'
| '/compile/'
@@ -516,6 +528,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof UsersPermissionsRouteImport
parentRoute: typeof UsersRouteRoute
}
+ '/users/memory-templates': {
+ id: '/users/memory-templates'
+ path: '/memory-templates'
+ fullPath: '/users/memory-templates'
+ preLoaderRoute: typeof UsersMemoryTemplatesRouteImport
+ parentRoute: typeof UsersRouteRoute
+ }
'/users/groups': {
id: '/users/groups'
path: '/groups'
@@ -588,12 +607,14 @@ const SessionsRouteRouteWithChildren = SessionsRouteRoute._addFileChildren(
interface UsersRouteRouteChildren {
UsersGroupsRoute: typeof UsersGroupsRoute
+ UsersMemoryTemplatesRoute: typeof UsersMemoryTemplatesRoute
UsersPermissionsRoute: typeof UsersPermissionsRoute
UsersIndexRoute: typeof UsersIndexRoute
}
const UsersRouteRouteChildren: UsersRouteRouteChildren = {
UsersGroupsRoute: UsersGroupsRoute,
+ UsersMemoryTemplatesRoute: UsersMemoryTemplatesRoute,
UsersPermissionsRoute: UsersPermissionsRoute,
UsersIndexRoute: UsersIndexRoute,
}
diff --git a/web-studio/src/routes/users/-components/memory-templates-page.test.tsx b/web-studio/src/routes/users/-components/memory-templates-page.test.tsx
new file mode 100644
index 000000000..c6c57d28e
--- /dev/null
+++ b/web-studio/src/routes/users/-components/memory-templates-page.test.tsx
@@ -0,0 +1,144 @@
+// @vitest-environment jsdom
+import { afterEach, expect, it, vi } from 'vitest'
+import {
+ cleanup,
+ fireEvent,
+ render,
+ screen,
+ waitFor,
+} from '@testing-library/react'
+import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
+import { MemoryTemplatesPage } from './memory-templates-page'
+import type * as MemoryTemplatesModule from '#/lib/memory-templates'
+
+const api = vi.hoisted(() => ({
+ fetch: vi.fn(),
+ save: vi.fn(),
+ reset: vi.fn(),
+}))
+vi.mock('#/lib/memory-templates', async (importOriginal) => ({
+ ...(await importOriginal<typeof MemoryTemplatesModule>()),
+ fetchMemoryTemplates: api.fetch,
+ updateMemoryTemplate: api.save,
+ resetMemoryTemplate: api.reset,
+}))
+vi.mock('#/hooks/use-app-connection', () => ({
+ useAppConnection: () => ({
+ connection: {
+ accountId: 'acme',
+ adminApiKey: 'admin-key',
+ baseUrl: 'http://localhost',
+ userId: 'admin',
+ },
+ connectionRole: 'admin',
+ isConnectionRoleLoading: false,
+ serverMode: 'api_key',
+ }),
+}))
+vi.mock('react-i18next', () => ({
+ useTranslation: () => ({ t: (key: string) => key }),
+}))
+vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn() } }))
+
+const schema = {
+ memory_type: 'profile',
+ description: 'Original rule',
+ directory: 'viking://user/{{ user_space }}/memories',
+ filename_template: 'profile.md',
+ enabled: true,
+ fields: [{ name: 'content', description: 'Profile body', merge_op: 'patch' }],
+}
+
+afterEach(() => {
+ cleanup()
+ vi.resetAllMocks()
+})
+
+it('publishes edited instructions with the locked schema values intact', async () => {
+ api.fetch.mockResolvedValue({
+ account_id: 'acme',
+ templates: [
+ {
+ memory_type: 'profile',
+ status: 'system_default',
+ updated_at: null,
+ defaults: schema,
+ effective: schema,
+ },
+ ],
+ })
+ api.save.mockResolvedValue({})
+ const client = new QueryClient({
+ defaultOptions: { queries: { retry: false } },
+ })
+ render(
+ <QueryClientProvider client={client}>
+ <MemoryTemplatesPage />
+ </QueryClientProvider>,
+ )
+
+ fireEvent.click(
+ (
+ await screen.findAllByRole('button', { name: /memoryTemplates.fileName/ })
+ )[0],
+ )
+ fireEvent.click(screen.getByRole('button', { name: 'memoryTemplates.edit' }))
+ fireEvent.change(
+ screen.getByRole('textbox', { name: 'memoryTemplates.typeDescription' }),
+ {
+ target: { value: 'New extraction rule' },
+ },
+ )
+ fireEvent.click(screen.getByRole('button', { name: 'memoryTemplates.save' }))
+
+ await waitFor(() => {
+ expect(api.save).toHaveBeenCalledWith(
+ expect.objectContaining({ accountId: 'acme', apiKey: 'admin-key' }),
+ 'profile',
+ {
+ ...schema,
+ description: 'New extraction rule',
+ },
+ )
+ })
+})
+
+it('shows the path pattern returned by the server', async () => {
+ const eventSchema = {
+ ...schema,
+ memory_type: 'events',
+ directory: 'viking://user/{{ user_space }}/memories/events',
+ filename_template: '{{ year }}/{{ month }}/{{ day }}/{{ event_name }}.md',
+ }
+ api.fetch.mockResolvedValue({
+ account_id: 'acme',
+ templates: [
+ {
+ memory_type: 'events',
+ status: 'system_default',
+ updated_at: null,
+ defaults: eventSchema,
+ effective: eventSchema,
+ },
+ ],
+ })
+ const client = new QueryClient({
+ defaultOptions: { queries: { retry: false } },
+ })
+ render(
+ <QueryClientProvider client={client}>
+ <MemoryTemplatesPage />
+ </QueryClientProvider>,
+ )
+
+ fireEvent.click(
+ (
+ await screen.findAllByRole('button', { name: /memoryTemplates.fileName/ })
+ )[3],
+ )
+ expect(
+ screen.getByText(
+ 'viking://user/{{ user_space }}/memories/events/{{ year }}/{{ month }}/{{ day }}/{{ event_name }}.md',
+ ),
+ ).toBeTruthy()
+})
diff --git a/web-studio/src/routes/users/-components/memory-templates-page.tsx b/web-studio/src/routes/users/-components/memory-templates-page.tsx
new file mode 100644
index 000000000..91fcbe3d4
--- /dev/null
+++ b/web-studio/src/routes/users/-components/memory-templates-page.tsx
@@ -0,0 +1,619 @@
+import * as React from 'react'
+import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
+import { Link } from '@tanstack/react-router'
+import {
+ ArrowLeftIcon,
+ BookOpenTextIcon,
+ BotIcon,
+ ChevronDownIcon,
+ ChevronRightIcon,
+ RotateCcwIcon,
+ UserRoundIcon,
+} from 'lucide-react'
+import { useTranslation } from 'react-i18next'
+import { toast } from 'sonner'
+import { Button } from '#/components/ui/button'
+import { Textarea } from '#/components/ui/textarea'
+import { useAppConnection } from '#/hooks/use-app-connection'
+import type { AdminConnection } from '#/lib/admin'
+import {
+ editableMemoryTypes,
+ fetchMemoryTemplates,
+ resetMemoryTemplate,
+ templateFieldValue,
+ updateMemoryTemplate,
+ withTemplateField,
+} from '#/lib/memory-templates'
+import type {
+ EditableMemoryType,
+ MemoryTemplate,
+ MemoryTemplateSchema,
+} from '#/lib/memory-templates'
+import { resolveStudioManagementCapabilities } from '#/lib/studio-permissions'
+
+const editableFields: Record<EditableMemoryType, string[]> = {
+ profile: ['description', 'fields.content.description'],
+ preferences: [
+ 'description',
+ 'fields.topic.description',
+ 'fields.content.description',
+ ],
+ entities: [
+ 'description',
+ 'fields.category.description',
+ 'fields.name.description',
+ 'fields.content.description',
+ ],
+ events: [
+ 'description',
+ 'fields.event_name.description',
+ 'fields.summary.description',
+ 'content_template',
+ ],
+ soul: [
+ 'description',
+ 'fields.core_truths.description',
+ 'fields.boundaries.description',
+ 'fields.vibe.description',
+ 'fields.continuity.description',
+ 'content_template',
+ ],
+ identity: [
+ 'description',
+ 'fields.creature.description',
+ 'fields.name.description',
+ 'fields.vibe.description',
+ 'fields.avatar.description',
+ 'fields.emoji.description',
+ 'fields.introduction.description',
+ 'content_template',
+ ],
+}
+
+function errorMessage(error: unknown) {
+ if (error instanceof Error) return error.message
+ return String(error)
+}
+
+function fieldValidationError(field: string, value: string) {
+ if (!value.trim()) return 'required'
+ if (field !== 'content_template' && [...value].length > 50000) {
+ return 'tooLong'
+ }
+ return null
+}
+
+export function MemoryTemplatesPage() {
+ const { t } = useTranslation('settings')
+ const { connection, connectionRole, isConnectionRoleLoading, serverMode } =
+ useAppConnection()
+ const { canManageUsers } = resolveStudioManagementCapabilities({
+ hasControlCredential: Boolean(connection.adminApiKey.trim()),
+ isRoleLoading: isConnectionRoleLoading,
+ role: connectionRole,
+ serverMode,
+ })
+ const adminConnection = React.useMemo<AdminConnection>(
+ () => ({
+ accountId: connection.accountId,
+ apiKey: connection.adminApiKey,
+ baseUrl: connection.baseUrl,
+ userId: connection.userId,
+ }),
+ [
+ connection.accountId,
+ connection.adminApiKey,
+ connection.baseUrl,
+ connection.userId,
+ ],
+ )
+ const queryClient = useQueryClient()
+ const queryKey = [
+ 'account-memory-templates',
+ adminConnection.baseUrl,
+ adminConnection.apiKey,
+ adminConnection.accountId,
+ ]
+ const templatesQuery = useQuery({
+ queryKey,
+ queryFn: () => fetchMemoryTemplates(adminConnection),
+ enabled: canManageUsers && Boolean(adminConnection.accountId),
+ })
+ const [selected, setSelected] = React.useState<EditableMemoryType | null>(
+ null,
+ )
+ const [editing, setEditing] = React.useState(false)
+ const [draft, setDraft] = React.useState<MemoryTemplateSchema | null>(null)
+ const [expanded, setExpanded] = React.useState<string>('description')
+ const [resetPrompt, setResetPrompt] = React.useState(false)
+
+ const template = templatesQuery.data?.templates.find(
+ (item) => item.memory_type === selected,
+ )
+ const saveMutation = useMutation({
+ mutationFn: (schema: MemoryTemplateSchema) =>
+ updateMemoryTemplate(adminConnection, selected!, schema),
+ onSuccess: async () => {
+ await queryClient.invalidateQueries({ queryKey })
+ setEditing(false)
+ setDraft(null)
+ toast.success(t('memoryTemplates.saved'))
+ },
+ onError: (error) =>
+ toast.error(t('memoryTemplates.saveFailed'), {
+ description: errorMessage(error),
+ }),
+ })
+ const resetMutation = useMutation({
+ mutationFn: () => resetMemoryTemplate(adminConnection, selected!),
+ onSuccess: async () => {
+ await queryClient.invalidateQueries({ queryKey })
+ setEditing(false)
+ setDraft(null)
+ setResetPrompt(false)
+ toast.success(t('memoryTemplates.resetDone'))
+ },
+ onError: (error) =>
+ toast.error(t('memoryTemplates.resetFailed'), {
+ description: errorMessage(error),
+ }),
+ })
+
+ if (isConnectionRoleLoading) {
+ return (
+ <p className="py-16 text-center text-sm text-muted-foreground">
+ {t('memoryTemplates.loading')}
+ </p>
+ )
+ }
+ if (!canManageUsers) {
+ return (
+ <div className="mx-auto max-w-xl rounded-2xl border bg-card p-8 text-center">
+ <p className="mb-5 text-sm text-muted-foreground">
+ {t('memoryTemplates.accessDenied')}
+ </p>
+ <Button nativeButton={false} render={<Link to="/settings" />}>
+ {t('memoryTemplates.openConnection')}
+ </Button>
+ </div>
+ )
+ }
+ if (templatesQuery.isPending) {
+ return (
+ <p className="py-16 text-center text-sm text-muted-foreground">
+ {t('memoryTemplates.loading')}
+ </p>
+ )
+ }
+ if (templatesQuery.isError) {
+ return (
+ <div className="mx-auto max-w-xl rounded-2xl border bg-card p-8 text-center">
+ <p className="mb-4 text-sm text-destructive">
+ {errorMessage(templatesQuery.error)}
+ </p>
+ <Button variant="outline" onClick={() => void templatesQuery.refetch()}>
+ {t('memoryTemplates.retry')}
+ </Button>
+ </div>
+ )
+ }
+
+ const choose = (memoryType: EditableMemoryType) => {
+ setSelected(memoryType)
+ setEditing(false)
+ setDraft(null)
+ setExpanded('description')
+ }
+ const current = draft ?? template?.effective
+ const changed = Boolean(
+ draft &&
+ template &&
+ JSON.stringify(draft) !== JSON.stringify(template.effective),
+ )
+ const hasInvalidField = Boolean(
+ selected &&
+ current &&
+ editableFields[selected].some((field) =>
+ fieldValidationError(field, templateFieldValue(current, field)),
+ ),
+ )
+
+ return (
+ <div className="min-w-0">
+ {!selected || !template ? (
+ <div className="w-full min-w-0 space-y-7 pb-12">
+ <header className="space-y-2">
+ <div className="flex items-center gap-3">
+ <div className="flex size-10 items-center justify-center rounded-xl border border-primary/20 bg-primary/5 text-primary">
+ <BookOpenTextIcon className="size-5" />
+ </div>
+ <h2 className="text-2xl font-semibold tracking-tight">
+ {t('memoryTemplates.title')}
+ </h2>
+ </div>
+ <p className="text-sm text-muted-foreground">
+ {t('memoryTemplates.subtitle')}
+ </p>
+ <p className="text-xs text-muted-foreground">
+ {t('memoryTemplates.account', { account: connection.accountId })}
+ </p>
+ </header>
+ <TemplateGroup
+ title={t('memoryTemplates.userGroup')}
+ hint={t('memoryTemplates.userGroupHint')}
+ icon={<UserRoundIcon className="size-12 stroke-[1.2]" />}
+ types={editableMemoryTypes.slice(0, 4)}
+ templates={templatesQuery.data.templates}
+ onSelect={choose}
+ />
+ <TemplateGroup
+ title={t('memoryTemplates.agentGroup')}
+ hint={t('memoryTemplates.agentGroupHint')}
+ icon={<BotIcon className="size-12 stroke-[1.2]" />}
+ types={editableMemoryTypes.slice(4)}
+ templates={templatesQuery.data.templates}
+ onSelect={choose}
+ />
+ </div>
+ ) : (
+ <div className="grid min-h-[680px] gap-6 pb-20 xl:grid-cols-[minmax(0,1fr)_minmax(320px,22%)]">
+ <main className="min-w-0 space-y-5">
+ <header className="flex flex-wrap items-start justify-between gap-4 border-b pb-5">
+ <div className="space-y-2">
+ <button
+ type="button"
+ onClick={() => {
+ setSelected(null)
+ setEditing(false)
+ setDraft(null)
+ }}
+ className="inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground"
+ >
+ <ArrowLeftIcon className="size-3.5" />{' '}
+ {t('memoryTemplates.back')}
+ </button>
+ <h2 className="text-2xl font-semibold">
+ {t(`memoryTemplates.${selected}`)}
+ </h2>
+ <p className="text-sm text-muted-foreground">
+ {t(`memoryTemplates.${selected}Hint`)}
+ </p>
+ </div>
+ <div className="flex flex-wrap items-center gap-2">
+ <span className="rounded-full border px-2.5 py-1 text-xs text-muted-foreground">
+ {t(
+ template.status === 'custom'
+ ? 'memoryTemplates.custom'
+ : 'memoryTemplates.default',
+ )}
+ </span>
+ {!editing ? (
+ <>
+ <Button
+ variant="outline"
+ disabled={template.status !== 'custom'}
+ onClick={() => setResetPrompt(true)}
+ >
+ <RotateCcwIcon className="size-4" />{' '}
+ {t('memoryTemplates.reset')}
+ </Button>
+ <Button
+ onClick={() => {
+ setDraft(structuredClone(template.effective))
+ setEditing(true)
+ }}
+ >
+ {t('memoryTemplates.edit')}
+ </Button>
+ </>
+ ) : null}
+ </div>
+ </header>
+ <div className="space-y-3">
+ {editableFields[selected].map((field) => (
+ <TemplateField
+ key={field}
+ field={field}
+ value={templateFieldValue(current!, field)}
+ defaultValue={templateFieldValue(template.defaults, field)}
+ expanded={expanded === field}
+ editing={editing}
+ onToggle={() => setExpanded(expanded === field ? '' : field)}
+ onChange={(value) =>
+ setDraft(withTemplateField(current!, field, value))
+ }
+ onReset={() =>
+ setDraft(
+ withTemplateField(
+ current!,
+ field,
+ templateFieldValue(template.defaults, field),
+ ),
+ )
+ }
+ />
+ ))}
+ </div>
+ </main>
+ <aside className="min-w-0 rounded-2xl border bg-muted/30 p-4 xl:sticky xl:top-5 xl:self-start">
+ <h3 className="mb-3 text-sm font-semibold">
+ {t('memoryTemplates.example')}
+ </h3>
+ <div className="overflow-hidden rounded-xl border bg-card">
+ <div className="break-all border-b bg-muted/20 px-4 py-3 font-mono text-xs text-muted-foreground">
+ {`${template.defaults.directory}/${template.defaults.filename_template}`}
+ </div>
+ <div className="min-h-52 p-4">
+ <pre className="whitespace-pre-wrap break-words rounded-lg border border-dashed bg-background p-4 font-mono text-xs leading-7 text-muted-foreground">
+ {t(`memoryTemplates.examples.${selected}`)}
+ </pre>
+ </div>
+ </div>
+ <p className="mt-3 text-xs leading-5 text-muted-foreground">
+ {t('memoryTemplates.exampleHint')}
+ </p>
+ </aside>
+ </div>
+ )}
+ {selected && editing && template ? (
+ <div className="sticky bottom-0 z-10 -mx-4 flex flex-wrap items-center justify-end gap-3 border-t bg-background/95 py-3 pl-4 pr-20 backdrop-blur md:-mx-8 md:pl-8 md:pr-20">
+ {changed ? (
+ <span className="mr-auto text-xs text-muted-foreground">
+ {t('memoryTemplates.changed')}
+ </span>
+ ) : null}
+ <Button
+ variant="outline"
+ onClick={() => {
+ setEditing(false)
+ setDraft(null)
+ }}
+ >
+ {t('memoryTemplates.cancel')}
+ </Button>
+ <Button
+ disabled={!changed || hasInvalidField || saveMutation.isPending}
+ onClick={() => {
+ if (current) saveMutation.mutate(current)
+ }}
+ >
+ {saveMutation.isPending
+ ? t('memoryTemplates.saving')
+ : t('memoryTemplates.save')}
+ </Button>
+ </div>
+ ) : null}
+ {resetPrompt && selected && template ? (
+ <div
+ className="fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4"
+ role="presentation"
+ onMouseDown={(event) => {
+ if (event.target === event.currentTarget) setResetPrompt(false)
+ }}
+ >
+ <div
+ role="dialog"
+ aria-modal="true"
+ aria-labelledby="reset-template-title"
+ className="w-full max-w-md rounded-2xl border bg-background p-6 shadow-xl"
+ >
+ <h3
+ id="reset-template-title"
+ className="mb-2 text-lg font-semibold"
+ >
+ {t('memoryTemplates.reset')}
+ </h3>
+ <p className="mb-6 text-sm leading-6 text-muted-foreground">
+ {t('memoryTemplates.confirmReset')}
+ </p>
+ <div className="flex justify-end gap-2">
+ <Button variant="outline" onClick={() => setResetPrompt(false)}>
+ {t('memoryTemplates.cancel')}
+ </Button>
+ <Button
+ disabled={resetMutation.isPending}
+ onClick={() => resetMutation.mutate()}
+ >
+ {t('memoryTemplates.confirm')}
+ </Button>
+ </div>
+ </div>
+ </div>
+ ) : null}
+ </div>
+ )
+}
+
+function TemplateGroup({
+ title,
+ hint,
+ icon,
+ types,
+ templates,
+ onSelect,
+}: {
+ title: string
+ hint: string
+ icon: React.ReactNode
+ types: readonly EditableMemoryType[]
+ templates: MemoryTemplate[]
+ onSelect: (memoryType: EditableMemoryType) => void
+}) {
+ const { t } = useTranslation('settings')
+ return (
+ <section className="grid overflow-hidden rounded-2xl border bg-card md:grid-cols-[minmax(200px,25%)_minmax(0,1fr)]">
+ <div className="relative flex min-h-52 items-center justify-center overflow-hidden border-b bg-muted/15 text-muted-foreground/60 md:border-r md:border-b-0">
+ <div className="absolute size-44 rounded-full border border-border/60" />
+ <div className="absolute size-32 rounded-full border border-border/70" />
+ <div className="relative flex size-20 items-center justify-center rounded-full border bg-background shadow-sm">
+ {icon}
+ </div>
+ </div>
+ <div className="min-w-0 px-5 py-5 md:px-7">
+ <h3 className="mb-4 flex flex-wrap items-baseline gap-x-2 text-base font-semibold">
+ {title}
+ <span className="text-sm font-normal text-muted-foreground">
+ · {hint}
+ </span>
+ </h3>
+ <div className="divide-y">
+ {types.map((type) => {
+ const template = templates.find((item) => item.memory_type === type)
+ return (
+ <button
+ key={type}
+ type="button"
+ onClick={() => onSelect(type)}
+ className="group flex w-full items-center justify-between gap-4 py-4 text-left first:pt-1 last:pb-0 hover:text-primary"
+ >
+ <span className="min-w-0">
+ <span className="flex items-center gap-2 font-medium">
+ {t('memoryTemplates.fileName', {
+ type: t(`memoryTemplates.${type}`),
+ })}
+ {template?.status === 'custom' ? (
+ <span className="rounded-full bg-primary/10 px-2 py-0.5 text-[10px] text-primary">
+ {t('memoryTemplates.custom')}
+ </span>
+ ) : null}
+ </span>
+ <span className="mt-1 block text-sm leading-6 text-muted-foreground">
+ {t(`memoryTemplates.${type}Hint`)}
+ </span>
+ </span>
+ <ChevronRightIcon className="size-4 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-1 group-hover:text-primary" />
+ </button>
+ )
+ })}
+ </div>
+ </div>
+ </section>
+ )
+}
+
+function TemplateField({
+ field,
+ value,
+ defaultValue,
+ expanded,
+ editing,
+ onToggle,
+ onChange,
+ onReset,
+}: {
+ field: string
+ value: string
+ defaultValue: string
+ expanded: boolean
+ editing: boolean
+ onToggle: () => void
+ onChange: (value: string) => void
+ onReset: () => void
+}) {
+ const { t } = useTranslation('settings')
+ const label =
+ field === 'description'
+ ? t('memoryTemplates.typeDescription')
+ : field === 'content_template'
+ ? t('memoryTemplates.contentTemplate')
+ : t(`memoryTemplates.fields.${field.split('.')[1] as 'content'}`)
+ const validationError = editing ? fieldValidationError(field, value) : null
+ return (
+ <section className="overflow-hidden rounded-xl border bg-card">
+ <div className="flex items-start justify-between gap-3 p-4">
+ <button
+ type="button"
+ onClick={onToggle}
+ aria-expanded={expanded}
+ className="min-w-0 flex-1 text-left"
+ >
+ <span className="flex flex-wrap items-baseline gap-2">
+ <span className="font-semibold">{label}</span>
+ <code className="text-xs text-muted-foreground">{field}</code>
+ </span>
+ <span className="mt-1 block text-xs leading-5 text-muted-foreground">
+ {field === 'description'
+ ? t('memoryTemplates.typeDescriptionHint')
+ : field === 'content_template'
+ ? t('memoryTemplates.contentTemplateHint')
+ : t('memoryTemplates.fieldDescription')}
+ </span>
+ </button>
+ {editing && value !== defaultValue ? (
+ <button
+ type="button"
+ onClick={onReset}
+ className="shrink-0 text-xs text-primary hover:underline"
+ >
+ {t('memoryTemplates.resetField')}
+ </button>
+ ) : null}
+ <button
+ type="button"
+ onClick={onToggle}
+ aria-label={label}
+ className="pt-1 text-muted-foreground"
+ >
+ <ChevronDownIcon
+ className={`size-4 transition-transform ${expanded ? 'rotate-180' : ''}`}
+ />
+ </button>
+ </div>
+ {expanded ? (
+ <div className="px-4 pb-4">
+ {editing ? (
+ <>
+ <Textarea
+ value={value}
+ onChange={(event) => onChange(event.target.value)}
+ aria-label={label}
+ className="min-h-56 resize-y font-mono text-xs leading-6"
+ />
+ <div className="mt-2 flex justify-end text-xs text-muted-foreground">
+ {[...value].length} /{' '}
+ {field === 'content_template' ? '—' : '50000'}
+ </div>
+ {validationError ? (
+ <p className="text-xs text-destructive">
+ {t(`memoryTemplates.${validationError}`)}
+ </p>
+ ) : null}
+ {field !== 'content_template' ? (
+ <div className="mt-3 rounded-lg bg-muted/40 p-3 text-xs">
+ <div className="font-medium">
+ {t('memoryTemplates.variable')}
+ </div>
+ <p className="my-1 text-muted-foreground">
+ {t('memoryTemplates.variableHint')}
+ </p>
+ <button
+ type="button"
+ onClick={() => onChange(`${value}{{ language }}`)}
+ className="rounded-md border bg-background px-2 py-1 font-mono hover:border-primary"
+ >
+ {t('memoryTemplates.languageVariable')}
+ </button>
+ <details className="mt-3">
+ <summary className="cursor-pointer font-medium">
+ {t('memoryTemplates.syntax')}
+ </summary>
+ <p className="mt-2 leading-5 text-muted-foreground">
+ {t('memoryTemplates.syntaxHint')}
+ </p>
+ <code className="mt-1 block break-all text-primary">
+ {t('memoryTemplates.syntaxExample')}
+ </code>
+ </details>
+ </div>
+ ) : null}
+ </>
+ ) : (
+ <pre className="max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-muted/50 p-4 font-mono text-xs leading-6 text-foreground/80">
+ {value}
+ </pre>
+ )}
+ </div>
+ ) : null}
+ </section>
+ )
+}
diff --git a/web-studio/src/routes/users/memory-templates.tsx b/web-studio/src/routes/users/memory-templates.tsx
new file mode 100644
index 000000000..81dcbe188
--- /dev/null
+++ b/web-studio/src/routes/users/memory-templates.tsx
@@ -0,0 +1,6 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { MemoryTemplatesPage } from './-components/memory-templates-page'
+
+export const Route = createFileRoute('/users/memory-templates')({
+ component: MemoryTemplatesPage,
+})
diff --git a/web-studio/src/routes/users/route.test.ts b/web-studio/src/routes/users/route.test.ts
index fadb0005f..0d4d1380f 100644
--- a/web-studio/src/routes/users/route.test.ts
+++ b/web-studio/src/routes/users/route.test.ts
@@ -6,6 +6,7 @@ it.each([
['/users', '/users/'],
['/users/groups', '/users/groups'],
['/users/permissions', '/users/permissions'],
+ ['/users/memory-templates', '/users/memory-templates'],
])('matches the user and permissions tab at %s', (path, routeId) => {
const router = createRouter({
routeTree,
diff --git a/web-studio/src/routes/users/route.tsx b/web-studio/src/routes/users/route.tsx
index c53262e25..c3ead79f8 100644
--- a/web-studio/src/routes/users/route.tsx
+++ b/web-studio/src/routes/users/route.tsx
@@ -20,6 +20,7 @@ import {
Trash2Icon,
UserRoundIcon,
UsersRoundIcon,
+ BookOpenTextIcon,
} from 'lucide-react'
import { useTranslation } from 'react-i18next'
import { toast } from 'sonner'
@@ -127,9 +128,11 @@ function UserManagementRoute() {
})
const activeTab = pathname.startsWith('/users/permissions')
? 'permissions'
- : pathname.startsWith('/users/groups')
- ? 'groups'
- : 'users'
+ : pathname.startsWith('/users/memory-templates')
+ ? 'memory-templates'
+ : pathname.startsWith('/users/groups')
+ ? 'groups'
+ : 'users'
return (
<Tabs
value={activeTab}
@@ -137,9 +140,11 @@ function UserManagementRoute() {
const to =
value === 'groups'
? '/users/groups'
- : value === 'permissions'
- ? '/users/permissions'
- : '/users'
+ : value === 'memory-templates'
+ ? '/users/memory-templates'
+ : value === 'permissions'
+ ? '/users/permissions'
+ : '/users'
void navigate({ to })
}}
className="w-full min-w-0"
@@ -164,6 +169,13 @@ function UserManagementRoute() {
<ShieldCheckIcon />
{t('acl.page.title')}
</TabsTrigger>
+ <TabsTrigger
+ value="memory-templates"
+ className={managementTabClassName}
+ >
+ <BookOpenTextIcon />
+ {t('memoryTemplates.tab')}
+ </TabsTrigger>
</TabsList>
<TabsContent value="users" className="pt-5">
{activeTab === 'users' && <Outlet />}
@@ -174,6 +186,9 @@ function UserManagementRoute() {
<TabsContent value="permissions" className="pt-5">
{activeTab === 'permissions' && <Outlet />}
</TabsContent>
+ <TabsContent value="memory-templates" className="pt-5">
+ {activeTab === 'memory-templates' && <Outlet />}
+ </TabsContent>
</Tabs>
)
}