Skip to content

Handbook knowledge

Serves the app’s handbook to the AI assistant. kumiko handbuch knowledge exports the pages per locale as JSON; the handbook-knowledge bundled feature mounts them as two query tools, so the assistant can answer how-do-I questions from the real handbook text.

  • Feature — createHandbookKnowledgeFeature({ pages, access, publicPath }). No entity, no migration; access decides which roles see the tools.
  • list-pages — catalog of id, kind, title and questions in the caller’s language.
  • read-page — one page body; the language falls back to the handbook’s default language, long pages are cut with a visible notice, unknown ids are not_found.
  • Test — setupTestStack and HTTP with an X-Locale header.
src/feature.ts fixed handbook JSON and the feature
src/__tests__/feature.integration.test.ts list-pages, read-page, fallback, not found

The feature entry point — embedded straight from the source file, so the code here is exactly what runs. Multi-file samples keep their remaining files next to it on GitHub (link below):

import { createHandbookKnowledgeFeature } from "@cosmicdrift/kumiko-bundled-features/handbook-knowledge";
// In an app this object is the output of `kumiko handbuch knowledge <config> --out <file>`.
const handbook = {
defaultLocale: "en",
locales: {
en: [
{
id: "prozess-add-tenant",
kind: "process" as const,
title: "Add a tenant",
questions: ["How do I add a tenant?"],
screens: [],
bodyMd: "Open the lease, choose Add tenant and confirm the change.",
},
{
id: "lease-detail",
kind: "screen" as const,
title: "Lease",
questions: [],
screens: [],
bodyMd: "The lease screen shows tenants, rent and documents.",
},
],
de: [
{
id: "prozess-add-tenant",
kind: "process" as const,
title: "Mieter hinzufügen",
questions: ["Wie füge ich einen Mieter hinzu?"],
screens: [],
bodyMd: "Vertrag öffnen, Mieter hinzufügen wählen und die Änderung bestätigen.",
},
],
},
};
export const handbookKnowledgeFeature = createHandbookKnowledgeFeature({
pages: handbook,
access: { roles: ["User"] },
publicPath: "/handbuch",
});

📄 On GitHub: samples/recipes/handbook-knowledge/src/feature.ts