online
← Back to notes

> less ./notes/context-mining-for-llm.md

Context mining for large codebases

How to extract not just files from a repository, but a useful context pack: entrypoints, dependencies, risk zones and decision history.

context-mining-for-llm.md lab: code-miner / repo context / LLM handoff

lab: code-miner / repo context / LLM handoff

Context: LLMs help with code when they receive the right context. But a large project cannot be placed into a prompt as-is: too much noise and too little structure.

Problem: string search finds matches, but it does not explain the system. For a task, it is more important to understand entrypoints, ownership boundaries, related models, migrations, side effects and tests that protect behavior.

Approach: code-miner should build a map: routes, controllers, models, views, assets, commands, config and recent related changes. The output should be a compact context pack that can be handed to an LLM or a human.

Conclusion: AI assistance in development often depends less on the model and more on context packaging. A good pack reduces hallucinations and speeds up review.

Next step: add file ranking by task proximity and an automatic list of questions when context is insufficient.