Adding memory to Junie

MCP and Claude-schema hooks in ~/.junie, with the digest on the first prompt

JetBrains' Junie — both the junie CLI and the agent AI Assistant runs in the IDE — records every session under ~/.junie/sessions and opens the next one without it, or anything from the other forty-two coding agents on the machine.

What Junie already has

Each session is an event log at ${JUNIE_HOME:-~/.junie}/sessions/<session-id>/events.jsonl, listed with its projectDir and taskName in sessions/index.jsonl. Setting JUNIE_HOME moves the whole store. Resuming a session runs cd <projectDir> && junie --session-id <id> --resume.

Adding recall

deja install junie-auto

deja install junie writes the MCP server to ~/.junie/mcp/mcp.json under mcpServers, installs the /deja command in ~/.junie/commands/deja.md, writes the skill to ~/.agents/skills, and adds standing rules in ~/.junie/AGENTS.md. deja install junie-auto adds the automatic recall hooks on top.

What gets wired

deja install junie-auto writes hooks to ~/.junie/config.json in Claude Code's schema. Someone comparing the file with Claude Code's will notice one difference: SessionStart is not where the project digest lives. Junie fires SessionStart, but its output is not delivered to the model, so the digest rides on the first prompt instead:

  • UserPromptSubmit runs deja hook-context --junie --once (delivering the project digest on the first prompt only) and deja hook-prompt --junie.
  • PreToolUse on Bash|Read|Edit runs deja hook-tool --junie. Because Junie has no PostToolUse or PreCompact hook event, --junie reads events.jsonl directly so a failed command's prior fix and any compaction recovery packet arrive on the next tool call or prompt.
  • SessionEnd closes the live session marker.

A project's own .junie/config.json hooks run beside these once the project is trusted.

The part that is not about this harness

The index covers every agent's transcripts on the machine — forty-three of them today, each in its own format — so a fix found in Claude Code or Cursor answers a question asked in Junie. Indexing and search are local, and credentials are stripped as the index is built (privacy).

Getting started · Deleting Junie session history · How Junie's store is read

Found this useful? Star deja-vu on GitHub.