How Mako uses retrieval-augmented generation to inject real-time project knowledge.
Mako includes a lightweight retrieval-augmented generation (RAG) system that gives the model curated knowledge about the Base ecosystem — without relying on the model’s training data alone.
User message │ ▼ ┌────────────────┐ ┌─────────────────────┐ │ Keyword scan │────▶│ Knowledge entries │ │ (85+ triggers) │ │ (15 JSON files) │ └────────────────┘ └──────────┬────────────┘ │ Top 2 matches (~500 tokens) │ ▼ ┌─────────────────────┐ │ Injected as system │ │ message before │ │ inference │ └─────────────────────┘
Before every inference call, the gateway scans the user’s message for known project keywords. If a match is found, relevant context is injected as a system message — so the model has accurate, up-to-date information without needing a separate retrieval step.
[Knowledge Context]Aerodrome (DeFi): The central DEX and liquidity hub on Base.Aerodrome is a ve(3,3) DEX that serves as the primary...Token: $AERO on baseWebsite: https://aerodrome.finance
The model can also call knowledge_search directly when it needs structured information. This uses a weighted scoring system:
Field
Score weight
Project name
+10
Keywords
+5 per match
Category
+3
Summary
+2
Details
+1
Returns up to 5 results, each with name, category, summary, details, token, and website.If called with an empty query, it returns all entries (name, category, and summary only) — useful for browsing.
Create a JSON file in gateway/src/knowledge/ following the schema above. The gateway loads all .json files from this directory at startup — no code changes required, just restart the server.
Choose keywords carefully. Each keyword becomes a trigger for auto-injection, so avoid overly generic terms that would match irrelevant queries.