Agent Tools · Context
Semantic code context for coding agents
Moderne Prethink gives coding agents compiler-accurate understanding of your codebase, so they reason from resolved structure, dependencies, and architecture instead of inferring from raw files and prompts. It’s computed deterministically, so it costs zero tokens to produce.
Where an agent's tokens go, per loop
- Discover + understand60%
- Plan15%
- Act the part that creates value20%
- Review + validate5%
Prethink precomputes that 60% — the agent reads the answer instead of re-deriving it every loop.
Why Prethink
Faster reasoning. Lower LLM costs. More consistent results.
The idea
What is Moderne Prethink?
Prethink is a structured, machine-readable representation of how your codebase actually works, built directly from deep insights into your code. It captures relationships, dependencies, conventions, and architecture, so agents can reason from resolved context instead of inferring from raw files and prompts.
How it compares
This isn’t RAG, embeddings, or prompt engineering. It’s Moderne Prethink.
Most ways of feeding context to an agent rebuild a partial, probabilistic picture on every interaction. Prethink resolves it once, deterministically, and lets every agent reuse it.
| Approach | How context is built | Result |
|---|---|---|
| MCP / RAG | Retrieved snippets | Partial, token-heavy inference |
| Embeddings | Probabilistic vectors | No semantic guarantees |
| Prompt engineering | Manual curation | Brittle, inconsistent |
| Moderne Prethink | Deterministic analysis of semantic code models | Compiler-accurate, reusable context |
How it works
How Moderne Prethink works: from code to context
Prethink builds a shared, system-level understanding of your codebase with deterministic analysis and customizable recipes, then points your agents at that context directly.
- Resolved types, symbols, and class hierarchies
- Structure, execution paths, and cross-repo dependencies
- Architectural patterns, call graphs, and service boundaries
- Transitive dependency chains and upgrade impact
- Works with your existing agents and internal tools
- Versioned with your code or stored centrally
- Reason from resolved structure, not raw files
- No context reconstruction on every interaction
- Refresh in the CI pipeline or on a scheduled cadence
- Re-run after major dependency updates or refactors
What agents understand
What agents can understand with Moderne Prethink
The payoff
Less guesswork. Lower costs. Better results.
Part of the agent toolset
Prethink is the Frame stage of Moderne’s agent toolset, exposed over MCP alongside Trigrep for search and recipes for transformation. See how the Lossless Semantic Tree is built.
The agent toolset
- DiscoverTrigrepFind
- UnderstandPrethinkFrame
- ActRecipesFix
- OperateChangelogGovern
FAQ
Frequently asked questions
LLMs need more than raw source files to understand large codebases. Accurate context comes from a resolved, system-level understanding that captures structure, dependencies, and relationships across repositories. Prethink deterministically derives this context directly from the codebase and keeps it refreshed as the code changes, giving agents a shared, up-to-date view they can reason from without scanning millions of lines on every task.
Hallucinations happen when agents infer how a system works from incomplete or fragmented context. Grounding agents in resolved, authoritative knowledge — real dependencies, service boundaries, and configuration — means they reason from verified structure instead of guessing, so hallucinations drop and outputs become more reliable.
Raw code is text without meaning attached. On its own it doesn’t convey resolved types, symbol relationships, architectural boundaries, or runtime behavior. LLMs have to infer those from snippets, which leads to partial understanding and errors. Structured, resolved context gives agents the meaning behind the code, not just the characters on the page.
Semantic code context represents what code means, not just what it says. It includes resolved symbols, types, dependencies, relationships between components, and architectural structure, so agents can reason about behavior, impact, and constraints instead of stitching together guesses from raw text.
Sending large volumes of raw code consumes tokens quickly and often has to be repeated across sessions and tasks. Agents spend tokens reconstructing context every time they work on a repository, which drives up inference costs — and that cost grows rapidly in large, multi-repo systems.
Structured context lets agents start from a shared understanding of the codebase instead of rebuilding it on every interaction. When key relationships and structure are already resolved, agents need fewer tokens to build their understanding, which lowers overall LLM usage and cost.
Service boundaries are rarely obvious from individual files. Agents need explicit knowledge of endpoints, integrations, and how components interact. Surfaced as structured context, that knowledge lets agents reason about impact across services instead of inferring boundaries from scattered code references.
Architecture diagrams built for humans are visual and descriptive, but not machine-readable. Prethink emits CALM-formatted architecture: structured representations of components and relationships that agents can query and validate, so they understand boundaries, dependencies, and system topology programmatically.
Recommendations are grounded when agents reason from authoritative, up-to-date knowledge of how the system actually works — resolved context derived from the codebase itself rather than ad hoc prompts or inferred relationships. Grounded context reduces guesswork and makes outputs more trustworthy.
Give your agents the context they’ve been missing.