knowledge

package
v0.31.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package knowledge gives memcode the baseline a senior engineer just HAS — curated, authoritative facts and idioms for common stacks (Vercel, Next, React, Node, Supabase…), embedded in the binary so they travel into any repo.

Why this exists: the routing models have weaker/staler recall of fast-moving framework specifics than a frontier model. A dogfood turn invented a custom NEXT_PUBLIC_COMING_SOON env var instead of Vercel's built-in VERCEL_ENV. The packs give the model an authoritative, ungated reference to consult — surfaced via a repo-detected pointer (deterministic FACT) and the `knowledge` tool (model judgment). We deliberately do NOT keyword-match the user's prose to force content in — that's CLI-side intent classification, which doctrine keeps out of the CLI.

Two kinds of content, deliberately separated (see the pack format):

  • Facts — authoritative, unconditional. Overrides the model's priors.
  • Idioms — greenfield defaults that DEFER to existing code (never refactor working code to satisfy them).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Names

func Names() []string

Names returns the catalog's pack names (for the session pointer).

Types

type Hints

type Hints struct {
	Files []string // files whose presence implies the stack, e.g. "vercel.json"
	Deps  []string // dependency names to look for in package.json / go.mod
}

Hints lists the cheap, deterministic signals that a repo uses this stack.

type Pack

type Pack struct {
	Name     string   // canonical slug, e.g. "vercel"
	Triggers []string // words in the user's text that surface this pack, e.g. ["vercel"]
	Detect   Hints    // repo-detection hints (files present / manifest deps)
	Facts    string   // authoritative, unconditional — the injected digest
	Idioms   string   // greenfield defaults (consult-only; defer to existing code)
}

Pack is one stack's curated knowledge, parsed from packs/<name>.md.

func Catalog

func Catalog() []Pack

Catalog returns every embedded pack, parsed once and sorted by name.

func Detect

func Detect(root string) []Pack

Detect returns the packs that fingerprint the repo at root — a file they name exists, or a dependency they name appears in package.json / go.mod. Deterministic and cheap; the net for turns where the user DIDN'T name the stack but is clearly working in it.

func Find

func Find(query string) []Pack

Find ranks packs against a free-text query for the tool's `find` mode — a substring hit on the name or any trigger. Simple by design; the catalog is small and curated.

func Get

func Get(name string) (Pack, bool)

Get resolves a pack by exact (case-insensitive) name.

func (Pack) Full

func (p Pack) Full() string

Full is the complete pack returned by the `knowledge` tool on consult — Facts AND Idioms, since a consult is the model deliberately reaching for the reference.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL