fleet-memory/hindsight-docs/docusaurus.config.ts
Nicolò Boschi 30a319a6ab
feat: bank template import/export with Template Hub (#819)
* feat(api): add bank template import/export endpoints

Add POST /banks/{bank_id}/import and GET /banks/{bank_id}/export
endpoints for declarative bank setup via JSON manifests.

A template manifest (version 1) can include bank config overrides
and mental model definitions. Import creates or updates mental
models matched by id, applies config as per-bank overrides, and
returns async operation IDs for content generation.

Export dumps a bank's explicit overrides and mental models as a
manifest that can be re-imported into another bank.

Includes control plane UI: bank creation dialog now accepts an
optional template JSON to pre-configure the bank on creation.

* docs: add Template Gallery page and bank templates reference

- Template Gallery (/templates) with search, category filter, manifest
  preview modal with copy-to-clipboard
- 5 starter templates: Customer Support, Research Assistant, Personal
  Journal, Code Review Buddy, Meeting Notes
- Bank Templates API reference doc (developer/api/bank-templates)
- Sidebar entry under API section

* docs: add Template Gallery links to navbar and sidebar

- Top navbar: "Templates" link between Integrations and Changelog
- Sidebar: "Template Gallery" in Resources section

* fix(docs): remove emoji icons, autofocus search, fix placeholder in template gallery

* docs: rename to Bank Templates, move to Resources sidebar only

* docs: add Bank Templates to Resources navbar dropdown

* feat(api): add directives to bank template import/export

- Add BankTemplateDirective model with name, content, priority, is_active, tags
- Import creates/updates directives matched by name
- Export includes all directives (active and inactive)
- Validation: duplicate names rejected, empty name/content caught
- Tests: 24 tests covering directives create/update, existing vs new
  bank import, validation, export with directives, full round-trip

* docs: add directives to bank templates docs and sample templates

* feat(api): add JSON Schema endpoint for bank template validation

- GET /v1/default/bank-template-schema returns the JSON Schema
  auto-generated from the Pydantic BankTemplateManifest model
- Static schema file at docs/static/bank-template-schema.json
- Docs updated with schema endpoint, static file link, and
  validation examples (Python jsonschema, Node ajv-cli)

* feat(api): live schema validation on import, fix schema endpoint path

- Move schema endpoint to /v1/bank-template-schema (system-level, not per-bank)
- Import endpoint now accepts raw JSON and validates with Pydantic manually,
  returning clean 400 errors instead of raw 422s for all validation failures
- All validation (schema + semantic) returns consistent 400 with detailed messages

* docs: add interactive JSON Schema viewer to Bank Templates page

Renders the Pydantic-generated schema as a collapsible property tree
with types, required badges, defaults, and descriptions. The schema
is imported from the static bank-template-schema.json file.

* ui: add template toggle switch and browse link to bank creation dialog

- Replace always-visible textarea with a switch toggle ("Import from template")
- Textarea only shows when switch is on, keeping the dialog clean by default
- Add "Browse templates" link pointing to hindsight.vectorize.io/templates
- Reset template state when switch is toggled off or dialog is cancelled

* ui: add empty state with Add Document CTA to data view

When a bank has 0 memories, the data view (all tabs: constellation,
graph, table, timeline) shows a centered empty state with a CTA
button that opens the Add Document dialog.

* docs: replace templates with Conversation and Coding Agent

Remove generic placeholder templates. Add two practical templates
based on actual integration patterns:

- Conversation: for chat agents (LiteLLM, LangGraph, Pydantic AI,
  Vercel AI SDK). Tracks user preferences, open threads.
- Coding Agent: for Claude Code/Codex. Tracks technical decisions,
  project context, developer preferences. High literalism.

* docs: rename gallery to Bank Templates Hub, keep API doc as Bank Templates

* docs: register layout-template and file-json icons in navbar and sidebar

* docs: register layout-template icon in DefaultNavbarItem for dropdown items

* docs: show integration icons on template cards

Templates now have an optional `integrations` field referencing
integration IDs from integrations.json. Icons are resolved at render
time and shown in the card header next to the category badge.

* docs: add Personal Assistant template for OpenClaw, Hermes, NemoClaw

* feat: add Export Template to bank actions + map all integrations to templates

- Add "Export Template" to the bank Actions dropdown — exports config,
  mental models, and directives as JSON, copies to clipboard
- Add export API route and client method
- Map remaining integrations to templates: CrewAI, AG2, Agno, Strands,
  LlamaIndex, local-mcp, skills → Conversation; hindclaw → Personal Assistant

* feat: add --template flag to LoCoMo benchmark + remove schema from Hub

- LoCoMo benchmark accepts --template <path> to apply a bank template
  manifest (config, mental models, directives) before ingestion
- Template is applied per-bank in both single-phase and two-phase modes
- BenchmarkRunner.apply_template() reuses the same engine methods as
  the /import API endpoint
- Remove Manifest Schema section from Bank Templates Hub page
  (schema stays in the API reference doc)

* refactor: remove description field from bank template manifest

* docs: remove tags, fact_types, and directives from starter templates

* docs: remove reflect_mission and disposition fields from starter templates

* build: validate template manifests against JSON Schema during docs build

* cleanup: remove unused JsonSchemaViewer component

* docs: remove retain_extraction_mode from starter templates

* ui: enable word wrap in template manifest preview

* docs: add link to Bank Templates reference doc from Hub page

* docs: convert bank templates doc to mdx with multi-language code snippets

- Convert bank-templates.md to .mdx with Tabs/CodeSnippet components
- Add example files: bank-templates.py, .mjs, .sh, .go with doc markers
- Examples cover import, dry-run, export, round-trip, and schema
- Regenerate OpenAPI spec and all client SDKs (Python, TS, Rust, Go)

* fix: migration revision collision + use typed models in benchmark template

- Rename merge migration d6e7f8a9b0c1 -> d6e7f8a9b0c2 to resolve
  revision ID collision with case_insensitive_entities_trgm_index
- Update a4b5c6d7e8f9 down_revision to point to the renamed migration
- Fix f-string lint in case_insensitive migration
- BenchmarkRunner.apply_template() now validates manifest through
  BankTemplateManifest Pydantic model instead of raw dict access
- Remove redundant inline imports (json, Path already at module top)

* fix(docs): add missing Go tab to dry-run code snippet

* ci: retrigger

* fix: sync skills openapi.json + fix bankId null type error in export

- Copy updated openapi.json to skills/hindsight-docs/references/
- Add null guard for bankId in Export Template onClick handler

* fix: sync generated files (memory_engine formatting, docs skill references)

* cleanup: remove obsolete migration collision workaround
2026-04-02 12:21:53 +02:00

404 lines
12 KiB
TypeScript

import {themes as prismThemes} from 'prism-react-renderer';
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
const umamiUrl = process.env.UMAMI_URL;
const umamiWebsiteId = process.env.UMAMI_WEBSITE_ID;
// Announcement bar - supports HTML for links
// Set to empty string '' to hide the bar
const ANNOUNCEMENT_BAR = 'Hindsight is State-of-the-Art on Memory for AI Agents | <a href="https://arxiv.org/abs/2512.12818" target="_blank">Read the paper →</a>';
const config: Config = {
title: 'Hindsight',
tagline: 'Hindsight: Agent Memory That Works Like Human Memory',
favicon: 'img/favicon.png',
future: {
v4: true,
},
markdown: {
mermaid: true,
},
url: 'https://hindsight.vectorize.io',
baseUrl: '/',
organizationName: 'vectorize-io',
projectName: 'hindsight',
trailingSlash: false,
onBrokenLinks: 'throw',
i18n: {
defaultLocale: 'en',
locales: ['en'],
},
headTags: [
{
tagName: 'link',
attributes: {
rel: 'preconnect',
href: 'https://fonts.googleapis.com',
},
},
{
tagName: 'link',
attributes: {
rel: 'preconnect',
href: 'https://fonts.gstatic.com',
crossorigin: 'anonymous',
},
},
{
tagName: 'link',
attributes: {
rel: 'stylesheet',
href: 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&family=Space+Grotesk:wght@500;600;700&display=swap',
media: 'print',
onload: "this.media='all'",
},
},
],
scripts: [
...(umamiUrl && umamiWebsiteId
? [
{
src: `${umamiUrl}/script.js`,
async: true,
defer: true,
'data-website-id': umamiWebsiteId,
},
]
: []),
],
presets: [
[
'classic',
{
docs: {
sidebarPath: './sidebars.ts',
routeBasePath: '/',
// Only show "next" version in development or when INCLUDE_CURRENT_VERSION=true
// In production, only show released versions from versions.json
onlyIncludeVersions: (() => {
const isDev = process.env.NODE_ENV === 'development' || process.env.INCLUDE_CURRENT_VERSION === 'true';
try {
const versions = require('./versions.json') as string[];
// In dev mode, explicitly include 'current' (Next) + all released versions
// In production, only show released versions
return isDev ? ['current', ...versions] : versions;
} catch {
return undefined; // No versions yet, show current
}
})(),
// Disable version badges on all versions
versions: (() => {
const config: Record<string, {badge: boolean}> = {
current: {badge: false},
};
try {
const versions = require('./versions.json') as string[];
versions.forEach((v: string) => {
config[v] = {badge: false};
});
} catch {
// No versions yet
}
return config;
})(),
},
blog: {
showReadingTime: true,
blogTitle: 'Hindsight Blog',
blogDescription: 'Updates, insights, and deep dives into agent memory',
postsPerPage: 'ALL',
blogSidebarCount: 0,
},
theme: {
customCss: './src/css/custom.css',
},
} satisfies Preset.Options,
],
[
'redocusaurus',
{
specs: [
{
id: 'hindsight-api',
spec: 'static/openapi.json',
route: '/api-reference',
url: '/openapi.json',
},
],
theme: {
primaryColor: '#0074d9',
sidebar: {
backgroundColor: '#09090b',
},
rightPanel: {
backgroundColor: '#18181b',
},
typography: {
fontSize: '15px',
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
headings: {
fontFamily: "'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
},
code: {
fontFamily: "'JetBrains Mono', 'Fira Code', 'SF Mono', Monaco, Consolas, monospace",
fontSize: '13px',
},
},
},
config: {
scrollYOffset: 60,
nativeScrollbars: true,
expandSingleSchemaField: true,
expandResponses: '200,201',
},
},
],
],
themes: [
'@docusaurus/theme-mermaid',
[
'@easyops-cn/docusaurus-search-local',
{
hashed: true,
docsRouteBasePath: '/',
indexBlog: true,
blogRouteBasePath: '/blog',
highlightSearchTermsOnTargetPage: false,
},
],
],
themeConfig: {
...(ANNOUNCEMENT_BAR && {
announcementBar: {
id: 'announcement',
content: ANNOUNCEMENT_BAR,
backgroundColor: '#0074d9',
textColor: '#ffffff',
isCloseable: false,
},
}),
image: 'img/logo.png',
colorMode: {
defaultMode: 'dark',
respectPrefersColorScheme: true,
},
navbar: {
logo: {
alt: 'Hindsight Logo',
src: 'img/logo.png',
style: { height: '32px' },
},
items: [
{
type: 'doc',
docId: 'developer/index',
position: 'left',
label: 'Developer',
className: 'navbar-item-developer',
},
{
to: '/integrations',
position: 'left',
label: 'Integrations',
className: 'navbar-item-integrations',
},
{
to: '/changelog',
position: 'left',
label: 'Changelog',
className: 'navbar-item-changelog',
},
{
type: 'dropdown',
label: 'Resources',
position: 'left',
className: 'navbar-item-resources',
items: [
{
to: '/templates',
label: 'Bank Templates Hub',
customProps: { icon: 'lu-layout-template' },
},
{
to: '/best-practices',
label: 'Best Practices',
customProps: { icon: 'lu-star' },
},
{
to: '/faq',
label: 'FAQ',
customProps: { icon: 'lu-circle-help' },
},
{
to: '/cookbook',
label: 'Cookbook',
customProps: { icon: 'lu-book' },
},
{
to: '/blog',
label: 'Blog',
customProps: { icon: 'lu-rss' },
},
{
to: '/api-reference',
label: 'API Reference',
customProps: { icon: 'lu-book-open' },
},
{
href: 'https://join.slack.com/t/hindsight-space/shared_invite/zt-3nhbm4w29-LeSJ5Ixi6j8PdiYOCPlOgg',
label: 'Community',
customProps: { icon: 'si-slack' },
},
{
href: 'https://benchmarks.hindsight.vectorize.io/',
label: 'Benchmarks',
customProps: { icon: 'lu-chart-bar' },
},
{
href: 'https://benchmarks.hindsight.vectorize.io/',
label: 'Which Model Should I Use?',
customProps: { icon: 'lu-cpu' },
},
{
href: 'https://arxiv.org/abs/2512.12818',
label: 'Paper',
customProps: { icon: 'lu-file-text' },
},
],
},
{
type: 'docsVersionDropdown',
position: 'right',
className: 'navbar-item-version',
},
{
href: 'https://ui.hindsight.vectorize.io/signup',
position: 'right',
label: 'Cloud',
className: 'navbar-item-cloud',
},
{
href: 'https://github.com/vectorize-io/hindsight',
position: 'right',
label: 'GitHub',
className: 'header-github-link',
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'Documentation',
items: [
{
label: 'Introduction',
to: '/',
},
{
label: 'Developer Guide',
to: '/developer/installation',
},
{
label: 'Clients & Integrations',
to: '/sdks/python',
},
{
label: 'API Reference',
to: '/api-reference/',
},
],
},
{
title: 'Resources',
items: [
{
label: 'Cookbook',
to: '/cookbook',
},
{
label: 'Changelog',
to: '/changelog',
},
{
label: 'Hindsight Cloud',
href: 'https://ui.hindsight.vectorize.io/signup',
},
],
},
{
title: 'Community',
items: [
{
label: 'GitHub',
href: 'https://github.com/vectorize-io/hindsight',
},
{
label: 'Slack',
href: 'https://join.slack.com/t/hindsight-space/shared_invite/zt-3nhbm4w29-LeSJ5Ixi6j8PdiYOCPlOgg',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} Vectorize, Inc.`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
additionalLanguages: ['bash', 'json', 'python', 'rust'],
},
mermaid: {
theme: {
light: 'base',
dark: 'base',
},
options: {
themeVariables: {
// Gradient start (#0074d9 blue) for nodes
primaryColor: '#0074d9',
primaryTextColor: '#ffffff',
primaryBorderColor: '#005db0',
// Gradient end (#009296 teal) for edges/clusters
secondaryColor: '#009296',
secondaryTextColor: '#ffffff',
secondaryBorderColor: '#007a7d',
// Tertiary
tertiaryColor: '#e6f7f8',
tertiaryTextColor: '#1e293b',
// Lines and edges - gradient end color
lineColor: '#009296',
// Text
textColor: '#1e293b',
// Node specific - gradient start
nodeBkg: '#0074d9',
nodeTextColor: '#ffffff',
nodeBorder: '#005db0',
// Main background
mainBkg: '#0074d9',
// Clusters/subgraphs - gradient end
clusterBkg: 'rgba(0, 146, 150, 0.08)',
clusterBorder: '#009296',
// Labels
edgeLabelBackground: 'transparent',
labelBackground: 'transparent',
// Font - Inter to match body text
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
},
},
},
} satisfies Preset.ThemeConfig,
};
export default config;