feat(api): bank template import/export#819
Merged
nicoloboschi merged 36 commits intomainfrom Apr 2, 2026
Merged
Conversation
d4f7168 to
de59e4f
Compare
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.
- 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
- Top navbar: "Templates" link between Integrations and Changelog - Sidebar: "Template Gallery" in Resources section
- 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
- 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)
- 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
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.
- 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
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.
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.
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.
…emplates - 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
- 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)
…pets - 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)
…plate - 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)
- Copy updated openapi.json to skills/hindsight-docs/references/ - Add null guard for bankId in Export Template onClick handler
8063f68 to
2a9dbd8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
POST /v1/default/banks/{bank_id}/importendpoint to import a JSON template manifest that declaratively sets up bank config + mental models in one callGET /v1/default/banks/{bank_id}/exportendpoint to export a bank's config overrides and mental models as a re-importable manifestidon re-import (creates new or updates existing)?dry_run=truefor validation-only modeversionfield (currently"1") for future schema evolution with auto-upgradeTest plan
test_bank_templates.pytests pass (validation, import, export, round-trip)./scripts/hooks/lint.sh)