# assistant-knowledge-sync (Agent Skill)

> Keep a site's AI chat assistant in step with the site: find what it is missing, move page copy into one module the page and the assistant both read, derive its site map from the sitemap, add never-quote guardrails and prove it with tests and probes.

Page: https://timerise.ai/skills/assistant-knowledge-sync

Agent Skill `assistant-knowledge-sync`: https://github.com/timerise-ai/assistant-knowledge-sync. Category: AI & integrations. Runs on Next.js; backend: No data store, repository content; the host's prompt, knowledge, tools and probe modules behind a seam.

Latest release: v0.1.2 (2026-10-08).

Install: npx skills add timerise-ai/assistant-knowledge-sync. A tool for an agent, not a module: nothing for Timerise to build or quote.

A site with an AI chat assistant has two copies of everything it says: the page, and what the assistant was told about the page. The first copy changes every week. The second changes when someone remembers. A month later the assistant links to a route that moved, describes a program the way it was before the rewrite, and quotes a price the site never published.

A longer prompt fixes it for one deploy. The facts were retyped, so they drift again with the next edit, and nothing shows that the model actually uses them when a visitor asks in their own words.

This skill gives a coding agent the update the way we run it on our own assistant: an audit of the gap between the pages and the assistant, page copy moved byte for byte into one data module that the page and the assistant both import, new pages added to the knowledge pack and the searchable corpus, a site map built from the sitemap's own sources, an explicit "never quote" line for every number the site has not published, and unit tests and live probes asked in a visitor's words that check routes and numbers.

Update what a site's AI chat assistant knows after the site changes: find the gap between the pages and the assistant, move page copy into one data module both read, add the new pages to the assistant's knowledge pack and searchable corpus, derive its site map from the sitemap source, write the routing and "never quote" guardrails, and prove it with unit tests and live probes. Use when: (1) a page, section, program, catalog or route was added or rewritten and the assistant should know about it, (2) the assistant answers with stale facts, wrong links, invented prices or sends people to the wrong form, (3) the sitemap changed and the assistant's site map did not, (4) the user mentions: update the assistant's knowledge, teach the chatbot about, the bot doesn't know about the new page, sync the AI assistant with the site, knowledge pack, system prompt facts, searchKnowledge, readKnowledgeDocument, KnowledgeDocument, tool description, site map for the assistant, sitemap.ts, the bot invents prices, never quote, probe the assistant. Carries the seven surfaces where assistant knowledge lives, the single-source refactor that keeps page and assistant reading the same words, guardrail templates, and regex probes that check routes and numbers. Next.js App Router sites whose assistant prompt is assembled in code from repository content (AI SDK or similar, with search and read tools); the host's prompt, knowledge, tools and probe modules are the seam. Not for building a chatbot, not vector or RAG infrastructure, not fine-tuning, and not for writing the page copy itself.

This skill was written by the engineer who has shipped this work. The earlier implementation it was audited against was the assistant of a marketing site, answering on more than one channel from one knowledge module. The procedure holds the properties an assistant update has to hold: page copy moved byte-for-byte so the page renders identically, a site map that gains a route whenever the sitemap does, tool descriptions that name every document kind in the corpus, the page's version shown where an external index lags it, and an explicit "never quote" line for every number the site has not published. Unit tests, a render check and regex probes verify each one; [`references/provenance.md`](references/provenance.md) has the record.

What it builds:
- A gap audit between pages and assistant
- Page copy moved into one data module the page and the assistant both read
- The knowledge pack and searchable corpus
- A site map derived from the sitemap source
- Routing and never-quote guardrails
- Unit tests and regex probes on routes and numbers

When to use:
- A page, section, partner program, product, catalog entry or route was added or rewritten.
- The sitemap changed and the assistant's site map did not.
- The assistant gives stale versions, wrong links, invented numbers, or routes people to the wrong form.
- After a content sync (a catalog pulled from another repository) the assistant still lists the old one.

Non-negotiables:
- Never retype page copy into the prompt. Import it from the module the page renders. A retyped copy is correct for one deploy; a unit test on the pack proves the imported line is there.
- Never rewrite the copy while moving it. A single-source refactor is byte-for-byte and the page renders identically, which the render check verifies. Wording changes are a separate commit and a separate decision.
- Never add a document kind without updating the tool descriptions and link rules. The model decides to search from the tool's description, not from what the corpus holds; a unit test finds the new kind and a probe expects its site path.
- Never ship without a probe per new fact and one per guardrail. Unit tests prove the pack contains the line; only a live probe proves the model uses it. With no model reachable, probes are reported as not run, never as passing.
- Never let the pack grow unbounded. Indexes and summaries go in the pack; full bodies stay behind the read tool. The pack's size is measured before and after.

Not this:
- Building the assistant, its chat widget or its streaming transport: [ai-sdk](https://ai-sdk.dev) for chat on the site, or [slack-ai-bot](https://github.com/timerise-ai/slack-ai-bot) for a Slack bot
- Embeddings, a vector store or hosted RAG: A RAG stack; this skill keeps an in-repo pack and a keyword corpus
- Writing or editing the page copy: The host's content workflow; this skill moves copy and never rewrites it
- Changing the model, provider or failover: The host's AI configuration
- A help center or blog the assistant should read: [help-center-markdown](https://github.com/timerise-ai/help-center-markdown) or [blog-markdown](https://github.com/timerise-ai/blog-markdown) to build it, then this skill to teach the assistant

What to tell your agent:
- Our site has a chat assistant; its code is below, save each file at its path first. We just shipped a partners page and the assistant knows nothing about it: people who ask about partnering get sent to sales, and yesterday it told someone they would earn 20%. Teach it about the partner program.

// lib/ai/knowledge.ts
export type KnowledgeKind = "help" | "page";

export interface KnowledgeDocument {
  kind: KnowledgeKind;
  title: string;
  url: string;
  summary: string;
  tags: string[];
  content: string;
}

const DOCS: KnowledgeDocument[] = [
  {
    kind: "help",
    title: "Booking widget",
    url: "/help/booking-widget",
    summary: "Embed a booking calendar on your site.",
    tags: ["widget", "calendar", "embed"],
    content: "Paste the script tag before the closing body tag. The widget reads your services and opening hours.",
  },
  {
    kind: "page",
    title: "Pricing",
    url: "/pricing",
    summary: "Plans and prices.",
    tags: ["price", "plan", "cost"],
    content: "Starter: 29 EUR a month. Pro: 79 EUR a month.",
  },
];

export function searchKnowledge(locale: string, query: string, limit: number): KnowledgeDocument[] {
  const tokens = query.toLowerCase().split(/\W+/).filter(Boolean);
  return DOCS.map((doc) => {
    const text = `${doc.title} ${doc.tags.join(" ")} ${doc.summary} ${doc.content}`.toLowerCase();
    return { doc, score: tokens.filter((t) => text.includes(t)).length };
  })
    .filter((r) => r.score > 0)
    .sort((a, b) => b.score - a.score)
    .slice(0, limit)
    .map((r) => r.doc);
}

export function readKnowledgeDocument(locale: string, url: string): KnowledgeDocument | undefined {
  return DOCS.find((doc) => doc.url === url);
}

export function getKnowledgePack(locale: string): string {
  return ["#### SITE MAP", "- Pricing: /pricing", "- Help: /help/booking-widget", "- Talk to sales: /contact"].join("\n");
}

// lib/ai/prompts.ts
import { getKnowledgePack } from "./knowledge";

export const searchDescription = "Full-text search across the help center and the pricing page.";

export function buildSystemPrompt(locale: string): string {
  return [
    "You are Ada, the assistant on our website. Answer questions about our booking software.",
    "Only discuss booking, pricing and help articles. For anything else, send people to /contact.",
    "Link pages with relative links.",
    getKnowledgePack(locale),
  ].join("\n\n");
}

// app/partners/page.tsx
const ROLES = [
  { name: "Referrer", body: "Introduce a client. We do the setup." },
  { name: "Implementer", body: "Set up the booking widget for your client. We review it before it goes live." },
];

const FAQ = [
  { q: "Who can join?", a: "Agencies and freelancers who set up booking for their clients." },
  { q: "How are partners paid?", a: "A share of the first year's subscription for every client you bring. The shares are published when the first round opens." },
];

export default function PartnersPage() {
  return (
    <main>
      <h1>Partner program</h1>
      <p>Bring clients to us and get paid for every one.</p>
      <h2>Roles</h2>
      <ul>
        {ROLES.map((role) => (
          <li key={role.name}>
            <strong>{role.name}</strong>: {role.body}
          </li>
        ))}
      </ul>
      <h2>FAQ</h2>
      {FAQ.map((item) => (
        <details key={item.q}>
          <summary>{item.q}</summary>
          <p>{item.a}</p>
        </details>
      ))}
      <p>
        <a href="/partners/apply">Apply to the program</a>
      </p>
    </main>
  );
}
- Our chatbot keeps telling visitors the Pro plan costs 49 EUR, but the pricing page says 79. Fix it so the two cannot drift apart again.
- Last month we renamed /pricing to /plans and added a catalog with a page per integration. Check whether our site assistant still sends people to the right places and tell me what you would change; do not edit anything yet.

Agent eval results (newest per agent and prompt):
- Gemini CLI (gemini-3.8-flash) on v0.1.2, 2026-10-08: pass (No data store)
- Codex CLI (gpt-6.1-sol) on v0.1.2, 2026-10-08: pass (No data store)
- Claude Code (claude-opus-5-5) on v0.1.2, 2026-10-08: pass (No data store)

Recent releases:
- v0.1.2 (2026-10-08): Fix release, from scoring the second round of prompt-1 agent eval runs against 0.1.1.
- v0.1.1 (2026-10-08): Fix release, from scoring the prompt-1 agent eval runs against 0.1.0.
- v0.1.0 (2026-10-08): First release: a procedure for teaching a Next.js site's AI chat assistant a new page, program or catalog from the repository's own content, verified by unit tests, a render check and regex probes.
