KING_CONTEXT/LOCAL_RETRIEVAL_LAYER

A retrieval layer for AI agents

Local first, token efficient, open source.

KING_CONTEXT_WORKFLOW
$ npx @king-context/cli init creating local retrieval layer initialized .king-context $ king-scrape https://docs.stripe.com --name stripe --yes Resolving provider: Firecrawl Scraping https://docs.stripe.com indexed stripe metadata: keywords, use_cases, tags, priority $ kctx search "authentication" --doc stripe stripe/authentication preview ~400 tokens $ kctx read stripe authentication --preview returning compact context slice $ kctx grep "Bearer" --doc stripe --context 3 result: Bearer token reference found in stripe docs $ kctx install stripe@v1 ready for agent retrieval
3.2xLess Tokens Per Query
170xFaster Metadata Lookup
100%Correct Facts (no hallucinations)

Use cases

Retrieval patterns for agent workflows that need exact commands, low token pressure, and local memory.

Vendor docs scraping

king-scrape https://docs.stripe.com --name stripe --yes

Open web research

king-research "prompt engineering techniques" --high --yes

Internal runbooks

kctx read stripe authentication --preview

ADR memory

kctx adr

Code agents

kctx grep "Bearer" --doc stripe --context 3

Content pipelines

Metadata-first retrieval for token efficient pipelines.

IDE integrations

kctx search "authentication" --doc stripe

Self-evolving retrieval

kctx install stripe@v1

How it works

Metadata narrows the search path before an agent reads full source text.

metadata.json
{
  "keywords": [
    "retrieval",
    "metadata",
    "token efficient",
    "local first",
    "open source"
  ],
  "use_cases": [
    "Vendor docs scraping",
    "Open web research",
    "Internal runbooks",
    "ADR memory",
    "Code agents",
    "Content pipelines",
    "IDE integrations",
    "Self-evolving retrieval"
  ],
  "tags": [
    "MCP",
    "CLI",
    "Firecrawl",
    "Crawl4AI",
    "Context7"
  ],
  "priority": "high"
}
01 keyword match

Search metadata first

kctx search "authentication" --doc stripe checks keywords, use_cases, tags, and priority before expanding context.

02 preview ~400 tokens

Read the relevant slice

kctx read stripe authentication --preview returns a compact preview instead of dumping an entire document.

03 full read

Escalate only when needed

The agent moves from metadata to preview to fulltext, preserving exact facts without unnecessary token load.

Benchmarks vs Context7

Round 1 compares MCP vs MCP. Round 2 compares Skill vs Skill.

ROUND_1_MCP_VS_MCP
Tokens968
Lookup1.15ms
Duplicates0
Round 1 MCP vs MCP
MetricKing ContextContext7
Tokens968 tokens3125
Metadata lookup1.15ms metadata200-500ms
Fulltext97.83ms fulltext
Duplicates0 duplicates11 duplicates
Relevance3.2 relevance2.8
Implementability4.4 implementability4.0
ROUND_2_SKILL_VS_SKILL
Median901
Correct100%
Quality4.79
Round 2 Skill vs Skill
MetricKing ContextContext7
Average tokens1064 médio1896 médio
Median tokens901 mediana1750 mediana
Correct facts38/38 correct (100%)32/38 (84%)
Hallucinations0.0 hallucinations0.33 hallucinations
Quality4.79 quality3.46 quality

Scraper providers

Firecrawl cloud zero-config or Crawl4AI local beta.

FIRECRAWL_PROVIDER
cloudzero-configdocs scraping

Firecrawl cloud zero-config

Cloud provider path for docs scraping with no local crawler setup.

SCRAPE_PROVIDER=firecrawl $ king-scrape https://docs.stripe.com --name stripe --yes
CRAWL4AI_PROVIDER
localbetacontrolled crawl

Crawl4AI local beta

Local provider path for teams that want scraping under local control.

SCRAPE_PROVIDER=crawl4ai $ king-scrape https://docs.stripe.com --name stripe --yes

Cookbooks

Reference workflows built on top of King Context.

Pixel-dithered ebook factory concept art for the ebook-factory cookbook
Content pipelineKing Context@Vadelo

ebook-factory by @Vadelo

Content pipeline cookbook for turning retrieved context into repeatable ebook production flows.

Stop dumping. Start retrieving.

npx @king-context/cli init