search-kb

A command for searching a Notion knowledge base, which is a collection of notes and documents stored in Notion. It can search pages and query databases using terms, filters, and sorting.

In plain words
What is it for?
Use it to find pages about topics such as authentication or APIs, search within a database, and filter results by fields such as status or tags.
Why use it?
It reduces the time spent looking through documentation manually and helps find more specific information in large workspaces.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/cyperx84/claude-code-plugin-examples/search-kb
Clone the repo
git clone --depth 1 https://github.com/cyperx84/claude-code-plugin-examples
Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,458 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00009 $0.01458
Opus 5 $0.00005 $0.00729
Sonnet 5 $0.00002 $0.00292
Haiku 4.5 $0.00001 $0.00146

Measured 2d ago against content hash ff8b0cec99fe, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

search-kb scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

examples/04-real-world/knowledge-base-plugin/commands/search-kb.md · 278 lines

How it starts

The opening of the file, as written. The whole thing — 278 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Search Knowledge Base

Search: $ARGUMENTS (query terms and filters)

Using Notion MCP for knowledge retrieval

Search Operations

1. Basic Search

// Search across all pages
const results = await notion.search({
  query: 'authentication',
  sort: {
    direction: 'descending',
    timestamp: 'last_edited_time'
  }
});

console.log(`Found ${results.results.length} pages`);
results.results.forEach(page => {
  console.log(`- ${page.properties.Name.title[0].text.content}`);
});

2. Filtered Search

// Search within specific database
const results = await notion.search({
  query: 'API',
  filter: {
    property: 'object',
    value: 'page'
  },
  sort: {
    direction: 'ascending',
    timestamp: 'last_edited_time'
  }
});

3. Database Queries

// Query with filters
const apiDocs = await notion.databases.query({
  database_id: 'api-docs-db',
  filter: {
    and: [
      {
        property: 'Status',
        select: {
          equals: 'Published'
        }
      },
      {
        property: 'Tags',
        multi_select: {
          contains: 'Backend'
        }
      }
    ]
  },
  sorts: [
    {
      property: 'Last Updated',
      direction: 'descending'
    }
  ]
});

4. Full-Text Search

async function fullTextSearch(searchTerm) {
  // Search in titles
  const titleResults = await notion.search({
    query: searchTerm,
    filter: { property: 'object', value: 'page' }
  });

  // Search in page content
  const contentResults = [];

  for (const page of titleResults.results) {
    const blocks = await notion.blocks.children.list({
      block_id: page.id
    });

    for (const block of blocks.results) {
      if (block.type === 'paragraph') {
        const text = block.paragraph.rich_text.map(t => t.text.content).join('');
        if (text.toLowerCase().includes(searchTerm.toLowerCase())) {
          contentResults.push({
            page: page.properties.Name.title[0]?.text.content,
            pageId: page.id,
            content: text,
            url: page.url
          });
        }
      }
    }
  }

  return contentResults;
}

Read the full file on GitHub · 278 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 278 lines · 9 tokens per session scan A ff8b0cec99fe

Subscribe to this mod's changes

search-kb is a command published in the GitHub repository cyperx84/claude-code-plugin-examples (2 stars, last pushed 10mo ago), licensed MIT. It adds 9 tokens to every session and 1,458 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.