The corpus-first pattern

JetBrains AI Assistant is built into IntelliJ IDEA, PyCharm, WebStorm, GoLand, and the rest of the JetBrains family. It generates code, refactors, and answers questions inside the editor. Like every other AI coding surface, it depends on context: the more accurate the project-specific signal it receives, the closer its output lands to what the team actually wants.

Mneme HQ's design is corpus-first. The architectural decisions for a project live in a single file — .mneme/project_memory.json — with typed, scoped, versioned records. That same file feeds every surface in the AI coding stack:

  • JetBrains AI Assistant reads the corpus as shared context. The model sees the team's real constraints when generating code.
  • Claude Code hooks intercept edits before they reach disk, blocking violations.
  • GitHub Actions runs mneme check against every PR diff — the deterministic backstop, regardless of which IDE or model produced the change.

One source of truth, multiple surfaces. The decision is written once, enforced everywhere.

No native JetBrains plugin yet. A first-party plugin is on the roadmap. Today, JetBrains teams get architectural governance through the corpus-as-context pattern below plus mneme check in CI — the same enforcement gate every other tool in the stack feeds into.

What you can do today

Capability How it works Where it runs
Shared AI context Attach .mneme/project_memory.json as project context for JetBrains AI Assistant IDE
Decision recording Use the Mneme CLI (or Claude Code's /mneme-record) to add structured decisions Terminal
CI enforcement mneme check --mode strict blocks PRs that violate the corpus GitHub Actions
Cross-tool consistency Same corpus feeds Claude Code, Cursor, JetBrains, and CI Everywhere

Install

  1. Install the package
    pip install mneme
  2. Initialise project memory
    mkdir .mneme
    # Create .mneme/project_memory.json — see examples/project_memory.json for the schema.
  3. Attach the corpus to JetBrains AI Assistant

    Open your JetBrains IDE settings, navigate to Tools → AI Assistant → Project Context, and pin .mneme/project_memory.json as a context file. AI Assistant now reads the corpus on every session.

  4. Add the CI enforcement gate

    Add mneme check --mode strict as a step in your GitHub Actions workflow (or your CI of choice). The corpus is now enforced at the merge boundary regardless of which IDE produced the diff.

    - name: mneme check
      run: |
        pip install mneme
        mneme check --mode strict

Why corpus-first matters here

The JetBrains ecosystem is broad. A backend team uses IntelliJ; a data team uses PyCharm; a frontend team uses WebStorm. Without a tool-agnostic governance layer, every IDE becomes its own configuration surface — per-IDE rules files, per-IDE prompts, per-IDE drift.

The corpus-first pattern removes that surface area. .mneme/project_memory.json sits at the root of the repo, in version control, reviewed in PRs like any other file. Every JetBrains IDE on every developer's machine reads the same file. When a decision changes, it changes in one place and propagates everywhere.

This is the same design that makes the Mneme HQ Claude Code hook and the GitHub Actions enforcement gate consistent: one corpus, multiple enforcement points, no per-tool duplication. JetBrains slots into that pattern the same way every other tool does.

The two enforcement layers

JetBrains AI Assistant context injection is the fast path: the model sees the constraints while you are typing, and most of the time it generates code that respects them. This shortens the inner loop — you get on-spec suggestions without round-tripping through review.

But context injection is advisory. Models attend imperfectly, particularly under long context windows or noisy prompts. That is why mneme check in CI is non-negotiable: it is the deterministic backstop. Every PR diff is checked against the corpus before merge. A violation fails the build — whether it came from JetBrains AI Assistant, Claude Code, Cursor, Copilot, or a hand-typed line of code.

The two layers are complementary. The IDE layer makes generation faster; the CI layer makes correctness guaranteed.

What's on the roadmap

  • Native JetBrains plugin. Direct in-editor enforcement (analogous to the Claude Code PreToolUse hook) for IntelliJ Platform IDEs. Recording decisions, querying the corpus, and surfacing violations without leaving the IDE.
  • MCP server. Mneme is on the roadmap to expose its decision store as an MCP server. JetBrains AI Assistant's MCP-aware sessions will then query the corpus directly rather than through pinned context files.
  • Per-language scope helpers. Smarter scope matching for JetBrains IDEs that specialise in one language (PyCharm, GoLand, RubyMine) where file naming conventions are tighter than in polyglot IntelliJ projects.

For the broader argument behind a single corpus across heterogeneous AI editors, see architectural governance across heterogeneous AI coding agents.

FAQ

Is there a Mneme HQ plugin for IntelliJ today?
Not yet. A native JetBrains plugin is on the roadmap. Today, teams use a corpus-first pattern: project_memory.json is the authoritative source of architectural decisions, the same corpus that feeds Claude Code hooks and the CI gate. JetBrains AI Assistant reads it as shared context, and mneme check enforces the corpus on every PR regardless of which tool produced the diff. See the roadmap for plugin timing.
How does this differ from a JetBrains AI Assistant rules file?
A rules file is per-IDE configuration; the Mneme corpus is tool-agnostic. The same project_memory.json that informs JetBrains AI Assistant is also what Claude Code's PreToolUse hook checks, what the GitHub Actions gate enforces, and what future surfaces will read. You write the decision once. Every surface enforces it. See why this matters across heterogeneous agents.
What if the model ignores the corpus context in JetBrains AI Assistant?
That is the central reason CI enforcement matters. Context injection is advisory — models attend to it imperfectly, especially under long context. mneme check in CI is the deterministic backstop: any diff that violates a recorded decision fails the build, no matter which IDE or model produced it. Editor-time context speeds the inner loop; CI enforcement guarantees correctness at the merge boundary. See why prompt memory fails at scale.
Which JetBrains IDEs does this pattern work with?
Any IDE in the JetBrains family — IntelliJ IDEA, PyCharm, WebStorm, GoLand, RubyMine, PhpStorm, Rider, CLion, DataGrip. The corpus is plain JSON at the repo root, so it does not depend on any IDE-specific feature. JetBrains AI Assistant ships across these IDEs uniformly; the same context-sharing pattern applies to all of them.