Episode 12: Is AI refactoring burning too many tokens? Give it a memory to save 99% tokens — compress the entire codebase into a knowledge graph

AI快递员

Learn a practical workflow to extract code semantics, generate embeddings, build a local knowledge graph and vector index, and wire a retrieval layer to an LLM for fast cross-file queries. Deliverables include a local code knowledge graph, vector search interface, and example retrieval-to-LLM flows to reduce long prompts and speed up lookups.

Image Analysis

Image 1 — Itemized transcription (translated from Chinese)

1. Readable text (line-by-line, left-to-right/top-to-bottom)

- “OPEN SOURCE · AI 代码库记忆” (in an oval label at the top; a small cyan dot at left)

- Main title line 1: “AI 改代码太烧钱?” (the question mark is red)

- Main title line 2: “给 AI 装个记忆”

- Secondary English: “codebase-memory-mcp”

- Small text: “@DeusData”

- Three boxed short texts (left to right):

- Box 1: “知识图谱” (with a brain icon above)

- Box 2: “省 99% token” (with a money-bag icon above)

- Box 3: “100% 本地” (with a lock icon above)

- Promotional line: “整个代码库压成一张图,AI 毫秒级查跨文件关系”

- Bottom info bar (left to right):

- Yellow star icon + “7.1k”

- Green text “今日 +2322”

- Gray text “MIT”

2. UI / layout elements

- Top oval label: “OPEN SOURCE · AI 代码库记忆”.

- Central title area: two-line large title (a question and a suggestion).

- Project identifier: English repo/name “codebase-memory-mcp” and account “@DeusData”.

- Three feature cards (with icons and short phrases) arranged horizontally: “知识图谱”, “省 99% token”, “100% 本地”.

- Promotional explanatory line below the feature cards.

- Bottom status bar: star count, today’s increase, license (MIT).

3. Charted / quantifiable information shown in the image

- Star count: displayed as “7.1k”.

- Today’s increment displayed as “+2322”.

- The image claims “省 99% token”.

- The image claims “100% 本地”.

- The image displays “MIT”.

4. Visual characteristics

- Dark background (near black / deep blue) with a fine rectangular grid.

- Dominant cyan-blue gradient color, title has bright cyan-to-blue gradient, question mark red.

- Elements have glow/neon effects (title and icon edges have halos).

- The three feature cards are rounded rectangles with subtle inner shadows.

- Icon style is flat and colorful (brain, money-bag, lock).

- Layout is vertically centered with clear top-to-bottom hierarchy.

5. Facts (directly readable or objectively observable in the image)

- The image displays the text: “AI 改代码太烧钱? 给 AI 装个记忆”.

- It shows the identifier “codebase-memory-mcp” and account “@DeusData”.

- The three feature cards read “知识图谱”, “省 99% token”, “100% 本地”.

- Promotional sentence reads: “整个代码库压成一张图,AI 毫秒级查跨文件关系”.

- Bottom shows “★ 7.1k · 今日 +2322 · MIT”.

- Background is a dark grid with cyan-blue highlights and glow.

6. Inferences (marked as inferences, not direct image facts)

- “codebase-memory-mcp” is likely a project or repository name.

- “@DeusData” is likely the project author/publisher account.

- “MIT” likely indicates an MIT license.

- The three cards likely advertise three main features: knowledge graph, token savings, fully local operation.

- The bottom “★ 7.1k” and “今日 +2322” likely indicate total stars and today’s new stars.

7. Unclear / low-resolution items

- Very small text or decorative elements inside the top oval are unreadable at current resolution.

- There may be additional icons/text at the bottom sides that are cropped.

- Any tiny annotations (copyright, footnotes) are not legible.

- It’s unclear if there are secondary captions under the feature icons.

8. Ignored actions

- No actions were taken on any UI elements; the image was only observed and transcribed.

SkillPI Creation Analysis

Intended use and image-evidence summary:

- The image appears to advertise an open-source project or demo (labeled “codebase-memory-mcp / @DeusData”) that claims to “compress the entire codebase into one graph” so AI can query cross-file relationships in milliseconds and advertises token savings and local operation. Those promotional statements are visible in the image (see image_text).

Likely associated skills and a high-level reproduction outline (requires verification of project specifics):

1) Code semantic extraction: parse source code to identify entities (functions, classes, modules), comments, and references to build nodes and edges representing code relationships.

2) Vectorization/embeddings: produce embeddings for code fragments, comments, and documentation to enable similarity search and linking.

3) Graph or index construction: organize extracted entities into a knowledge graph and/or build a vector index to support efficient lookup and neighborhood queries.

4) Retrieval layer and LLM integration: use retrieved graph nodes or nearby vectors as context for an LLM (retrieval-augmented generation, RAG) instead of sending whole files as tokens.

5) Local deployment: run embedding generation, index storage, and retrieval services locally to meet privacy/offline requirements.

Prerequisites for attempting reproduction:

- Access to the target codebase (source files and documentation).

- An embedding method or model (local or hosted) to encode code and docs into vectors and sufficient compute for embedding generation.

- A local storage/retrieval backend (vector DB or graph DB) that supports low-latency queries.

- A middleware layer that assembles retrieved context and interacts with an LLM for downstream tasks.

Items that must be verified (claims visible in image but not validated here):

- The concrete methodology and measurement behind the “save 99% token” claim (which scenarios and metrics were used).

- Whether “100% local” covers embedding generation, indexing, and model inference, or whether external downloads/services are required.

- The actual repository or release corresponding to “codebase-memory-mcp” and whether the source code and docs are available.

- Which embedding models, index backends, and graph/data structures the project uses, and whether they are open-source.

Note and caution:

- The above is a technical interpretation and suggested reproduction path based on common patterns (embeddings + vector search + graph assembly + RAG). It is not a validation of the project’s claims. To confirm performance and local/offline guarantees, obtain the project source and run controlled tests.

Original creation ↗