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.

Why Prethink

Faster reasoning. Lower LLM costs. More consistent results.

Structure Structured semantic context for agents Your codebase’s full structure, dependencies, configurations, and conventions become resolved context, so agents reason from facts, not inferences.
Efficiency Faster results with fewer tokens Agents stop reconstructing the repository on every query and work from an authoritative understanding of the code, requiring fewer tokens.
Control Fully customizable knowledge Knowledge is generated programmatically with Moderne recipes, so teams can customize Prethink’s output to their environment.

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.

ApproachHow context is builtResult
MCP / RAG Retrieved snippetsPartial, token-heavy inference
Embeddings Probabilistic vectorsNo semantic guarantees
Prompt engineering Manual curationBrittle, inconsistent
Moderne Prethink Deterministic analysis of semantic code modelsCompiler-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.

Step 01 Build LST code models per repo An LST is a fully resolved, compiler-accurate model of the repository, capturing both the structure and the meaning of the code.
  • Resolved types, symbols, and class hierarchies
  • Structure, execution paths, and cross-repo dependencies
Step 02 Run Prethink recipes to build context Recipes run on the LSTs to bootstrap repository-level knowledge quickly and consistently — structure, intent, constraints, and relationships.
  • Architectural patterns, call graphs, and service boundaries
  • Transitive dependency chains and upgrade impact
Step 03 Put context where agents work Recipes output inspectable CSV, Markdown, and CALM artifacts to a repo or context registry, and agent configurations are pointed at Prethink.
  • Works with your existing agents and internal tools
  • Versioned with your code or stored centrally
Step 04 Agents access Prethink in their workflow Agents reference Prethink to understand resolved knowledge about the code without parsing it, shifting effort away from inferring and toward execution.
  • Reason from resolved structure, not raw files
  • No context reconstruction on every interaction
Step 05 Keep context up to date continuously Teams control exactly when and how context is refreshed — in CI, on a schedule, or after major dependency updates and refactors.
  • 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

Semantic structure and patterns How code is meant to be written and organized in your environment, reducing rework from violating conventions.
Service interfaces and integrations Resolved service endpoints, external calls, and integration points, so agents can reason about downstream impact.
Dependency intelligence Compatibility, risk, and upgrade impact across direct and transitive dependencies, without incomplete scans or guesswork.
Security & configuration context Runtime behavior and security posture based on real configuration, not inferred assumptions.
Architecture & relationships (CALM) CALM-formatted architecture gives agents an explicit model of system structure, boundaries, and relationships.
Test coverage & intent How code is validated and what tests cover, making it easier to propose safe changes and spot gaps.

The payoff

Less guesswork. Lower costs. Better results.

Save tokens Less token waste Prethink eliminates repeated context reconstruction, cutting token usage and time across sessions and workflows.
Trust output Fewer hallucinations With real structure and relationships in context, agents hallucinate less and produce more reliable output.
Consistency More consistent output Teams get predictable results because agents work from the same trusted context every time.

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.

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.