{"modulePath":"github.com/memcode-ai/memcode","version":"v0.56.16","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package knowledge\n\nPackage 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.\n\nWhy 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.\n\nTwo kinds of content, deliberately separated (see the pack format):\n\n  - Facts  — authoritative, unconditional. Overrides the model's priors.\n  - Idioms — greenfield defaults that DEFER to existing code (never refactor working code to satisfy them).\n\n## Functions\n\n```go\nfunc Names() []string\n```\nNames returns the catalog's pack names (for the session pointer).\n\n## Types\n\n```go\ntype Hints struct {\n\tFiles []string // files whose presence implies the stack, e.g. \"vercel.json\"\n\tDeps  []string // dependency names to look for in package.json / go.mod\n}\n```\nHints lists the cheap, deterministic signals that a repo uses this stack.\n\n```go\ntype Pack struct {\n\tName     string   // canonical slug, e.g. \"vercel\"\n\tTriggers []string // words in the user's text that surface this pack, e.g. [\"vercel\"]\n\tDetect   Hints    // repo-detection hints (files present / manifest deps)\n\tFacts    string   // authoritative, unconditional — the injected digest\n\tIdioms   string   // greenfield defaults (consult-only; defer to existing code)\n}\n```\nPack is one stack's curated knowledge, parsed from packs/\\\u003cname\u003e.md.\n\n```go\nfunc Catalog() []Pack\n```\nCatalog returns every embedded pack, parsed once and sorted by name.\n\n```go\nfunc Detect(root string) []Pack\n```\nDetect 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.\n\n```go\nfunc Find(query string) []Pack\n```\nFind 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.\n\n```go\nfunc Get(name string) (Pack, bool)\n```\nGet resolves a pack by exact (case-insensitive) name.\n\n```go\nfunc (p Pack) Full() string\n```\nFull 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.\n\n","path":"github.com/memcode-ai/memcode/internal/knowledge","name":"knowledge","synopsis":"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.","isRedistributable":true}
