Liking cljdoc? Tell your friends :D

Emacs Integration

Status: Proof of Concept

Atlas provides Emacs integration via CIDER, a transient-based interface for exploring semantic registries directly from your editor. Combined with the visual explorer UI, you get both code-editor and browser-based exploration.

Screenshots

Emacs transient menu Main transient menu with browse, entity details, and validation commands

Entity info buffer Entity details showing aspects, data flow, and dependencies

registry detail registry detail

Prerequisites

  • Emacs 27.1+
  • CIDER 1.0+
  • Transient 0.4+
  • A running nREPL connection to your Clojure project

Installation

  1. Copy the emacs/ directory to your Emacs load path:
git clone https://github.com/semantic-namespace/atlas.git
# Then add to your Emacs config:
  1. Add to your Emacs config (~/.emacs.d/init.el):
(add-to-list 'load-path "/path/to/atlas/emacs")
(require 'atlas)

;; Optional: bind main menu to a key
(global-set-key (kbd "M-F") 'atlas)
  1. Ensure CIDER is installed:
(use-package cider :ensure t)
(use-package transient :ensure t)

Setup in CIDER

Before using Emacs exploration, start your Clojure REPL and initialize the registry:

;; Start REPL with cider-jack-in
;; Then initialize your application
(require '[app.my-app])
(app/init-registry!)

;; Or load sample data
(require '[atlas.atlas-ui.sample-registry :as sample])
(reset! atlas.registry/registry sample/sample-registry)

Quick Start

Editor-based exploration (Emacs)

  1. Start your Clojure REPL with M-x cider-jack-in
  2. Initialize your registry: (require '[app.my-app]) (app/init-registry!)
  3. Press M-F (or M-x atlas) to open the menu

Browser-based exploration (Visual Explorer)

Optionally open the visual explorer alongside:

(require '[atlas.atlas-ui.server :as ui])

;; Start v1 (graph view)
(ui/start! {:ui-version :v1})

;; Or v2 (dual map view)
(ui/start! {:ui-version :v2})

Then explore in your browser while using Emacs for detailed information.

Both provide complementary views of your registry.

Main Menu

The main menu (M-x atlas) provides:

Browse

KeyCommandDescription
eList entitiesShow all registered entities grouped by type
aFind by aspectFind entities with a specific aspect
AList aspectsShow all aspects with usage counts

Authoring

KeyCommandDescription
NInteractive author entityGuided entity creation with live similarity feedback
+Add aspect to setAdd aspect to #{...} with real-time similarity score
sAspect statsShow how many entities share each aspect with an entity
SAspect stats at pointShow aspect stats for entity at cursor
IInsert aspectTwo-step completion: select namespace, then name
DInsert dev-idInsert existing dev-id with type annotation
PAspect paletteBrowse all available aspects (click to copy)
~Similar at pointShow similar entities with aspect differences (✓/−/+)

See Authoring Guide for how suggestion and similarity work under the hood.

Entity Details

KeyCommandDescription
iEntity infoDetailed info for an entity
DDependenciesWhat this entity depends on
RDependentsWhat depends on this entity

Business Semantics

KeyCommandDescription
bList business entitiesPatterns, constraints, failure modes, etc.
BBusiness infoDetailed business entity info
MBusiness aspects ofBusiness aspects applied to a technical entity

Protocols

KeyCommandDescription
@List protocolsShow all registered protocols
#Protocol infoProtocol details and implementers
$Component protocolsProtocols implemented by a component

Data Flow

KeyCommandDescription
dData flow traceTrace data inputs for a function
pProducersFind what produces a data key
uConsumersFind what consumes a data key
xExecution orderTopologically sorted execution order

Validation

KeyCommandDescription
cCheck invariantsRun all invariant validations
GRefresh cacheInvalidate completion cache
!Toggle debugEnable/disable debug messages

Source (Lens)

KeyCommandDescription
LToggle lens modeOverlay register! forms with signature cards
mCycle lens modeCycle: raw → semantic → impl
rRefresh lensRe-scan and re-fetch overlays

Slice Buffers

atlas-slice opens a dedicated org-mode buffer assembled from the live registry — not tied to any source file. Each entity becomes an org heading with a prose narrative body. Entities are topologically sorted (dependencies appear before dependents) and tagged by type, domain, and intent for native org filtering.

M-x atlas-slice-entity   RET :fn.ide/data-flow RET      ; entity only (depth 0)
C-u 1 M-x atlas-slice-entity RET :fn.ide/data-flow RET  ; entity + direct deps
M-x atlas-slice-aspect   RET :domain/ide RET            ; all entities in a domain
M-x atlas-slice          RET                            ; interactive dispatcher

Inside a slice buffer:

KeyAction
TABExpand / collapse heading
iInspect entity at point — compact :semantic card in a bottom window
sJump to source — grep for the register! call of entity at point
g / C-c C-l rRefresh (re-fetch from REPL)
C-c \Org tag filter — e.g. :trace:, :ide:, :execution_function:
qBury buffer

The buffer opens folded — all headings visible, bodies collapsed. Use TAB to expand individually or S-TAB to cycle global fold state. Requires an active CIDER connection and atlas.ide.narrative on the classpath.

Tags on each heading are derived from the entity's type, domain, and intent:

* fn.ide/data-flow  :execution_function:ide:trace:

Use C-c \ then :trace: to sparse-tree only trace-intent entities, or :ide: for the full IDE domain.

Internal links: entity refs in deps-prose are clickable org links — C-c C-o on [[*fn.ide/entity-info][fn.ide/entity-info]] jumps to that entity's heading.

Summary section: a * Summary heading at the top shows total entity count and breakdown by type.

Lens Mode replaces verbose register! forms with template-driven views of the entity's semantic identity. Three modes cycle with C-c C-l m:

ModeWhat you seeFetch
:rawActual source, no overlay—
:semanticBadge · dev-id · aspects · context · response · depsentity props from registry
:implImplementation function · context · depsentity props from registry

For prose narrative view use atlas-slice instead — it generates a dedicated org-mode buffer with full graph-derived context.

Cards are purely visual — buffer content is untouched, so LSP/CIDER/paredit work normally. Moving the cursor into a form reveals the real source code.

Uses clojure-lsp to find register! calls regardless of namespace alias.

Advanced Menu

Press z from the main menu to access advanced features:

Architecture Analysis

KeyCommandDescription
tBy tierGroup entities by architectural tier
VArchitecture viewFull architecture documentation
OOperations viewExternal integrations, pure functions
CDomain couplingInter-domain dependency analysis

Impact & Refactoring

KeyCommandDescription
IImpact of changeWhat's affected if an entity changes
YAspect impactWhat's affected if an aspect changes
rPreview refactorDry-run aspect rename
~Similar entitiesFind semantically similar entities

Compliance & Quality

KeyCommandDescription
PPII surfaceFind entities handling PII
EError handler coverageCheck error handling coverage
TTrace data flowTrace a data key through the system

Authoring Tools (Advanced)

KeyCommandDescription
nCreate new aspectCreate a new aspect with guided prompts
eScaffold entityInsert template code for a new entity

Ontology Tools

KeyCommandDescription
SSuggest aspectsGet aspect suggestions for an entity
XInspect entityQuick inspection
KAspect catalogBrowse all aspects with stats
LList templatesShow available templates

Documentation & Export

KeyCommandDescription
gGenerate docsGenerate markdown documentation
lLLM contextExport context for LLM consumption
sSystem summaryHigh-level system overview

Buffer Navigation

In result buffers:

KeyAction
Click on entityShow entity info
Click on aspectFind entities with aspect
dJump to definition (searches for contract/def)
gRefresh buffer
?Show menu
qQuit window

Emacs vs Visual Explorer

Use Emacs when you want:

  • Quick lookup without leaving your editor
  • Detailed entity information (aspects, data flow, dependencies)
  • Smart completion for entities, aspects, and data keys
  • Deep analysis (impact of changes, PII surface, etc.)
  • Integration with your code (jump-to-definition)

Use Visual Explorer when you want:

  • Graph visualization of relationships
  • Multi-aspect query builder
  • Lens-based filtering
  • High-level architecture overview
  • Shareable views for team discussion

Optimal workflow: Use both simultaneously:

  • Visual Explorer in browser for exploration and design discussions
  • Emacs for detailed investigation and understanding
  • Both auto-detect hostname for seamless remote access

How It Works

The Emacs integration communicates with your running Clojure REPL via CIDER. It calls functions in the atlas.ide namespace, which provides a clean API returning EDN that Emacs can parse and display. The Visual Explorer is a separate browser-based UI that calls the HTTP API.

┌──────────────────────────────────────────────────────────────┐
│                     Clojure REPL                             │
│                  (cider-jack-in)                             │
│                                                              │
│  ┌────────────────────────────────────────────────────────┐ │
│  │  atlas.registry (global atom with all entities)        │ │
│  └────────────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────┘
       ↑              ↑                          ↑
       │ CIDER/nREPL  │ HTTP API                │
       │ (atlas.ide)  │ (atlas.atlas-ui.server) │
       │              │                          │
   ┌───────────┐  ┌──────────────┐         ┌──────────────┐
   │   Emacs   │  │ Visual       │         │ shadow-cljs  │
   │  (Atlas)  │  │ Explorer     │         │ dev watch    │
   │           │  │ (Browser)    │         │              │
   └───────────┘  └──────────────┘         └──────────────┘

The atlas.ide namespace provides:

  • EDN structures that Emacs can parse
  • Caches reverse dependencies for fast lookups
  • Indexes data keys for producer/consumer queries
  • Completion candidates for entity, aspect, and data-key inputs

The Visual Explorer server provides:

  • HTTP /api/atlas/registry endpoint
  • Static file serving for compiled UI (v1 and v2)
  • Registry watching for manual refresh prompts

Completion

The package provides smart completion with annotations:

  • Entity completion: Shows entity type (function, component, endpoint)
  • Aspect completion: Shows usage count
  • Data key completion: Autocomplete context/response keys

Works with ivy, selectrum, vertico, or default Emacs completion.

Troubleshooting

"CIDER not connected"

Run M-x cider-jack-in or M-x cider-connect first.

"No entities found"

Make sure you've initialized your registry:

(require '[atlas.ontology :as ont])
(ont/register-entity-types!)
;; Then register your entities...

Stale data in Emacs

Press G (refresh cache) in the menu, or g in a result buffer.

Visual Explorer shows "Loading registry..."

  • Ensure the REPL server is running: (atlas.atlas-ui.server/status)
  • Check the browser console (F12) for network errors
  • If using ?port=8082, verify that port's server is running
  • The UI auto-detects hostname, but network connectivity issues can occur

Emacs completion not working

Run G (refresh cache) to rebuild the index.

Debug mode

Press ! to toggle debug messages in Emacs (shows raw EDN responses). For Visual Explorer, check the browser console (F12) for API responses.

Remote Access

Both Emacs integration and Visual Explorer support remote development:

Emacs Integration:

  • Emacs connects directly to CIDER via nREPL
  • Works locally via cider-jack-in or cider-connect to remote nREPL
  • No special configuration needed

Visual Explorer:

  • Automatically detects the browser's hostname/IP
  • When accessing http://<server-ip>:8081/?port=8082, API calls go to http://<server-ip>:8082/api/atlas/registry
  • Works over any network (localhost, LAN, VPN, etc.)

Pair with an LLM (Claude Code)

Experimental.

An LLM session can drive a dedicated Emacs daemon while you watch it from a terminal. You ask in plain words ("what breaks if I change the database?"), the LLM opens the matching layout in your frame (one tab per view), and then reads your screen back and compares it with the REPL before describing anything.

The LLM does the setup: it picks the project's REPL, starts the daemon, and connects CIDER. You only attach.

One-time setup (per person)

# 1. Make the /atlas-emacs skill available to Claude Code
#    (a symlink, so it stays in sync with the code)
emacs/atlas-llm-daemon.sh install-skill           # sessions opened in this repo (all skills)
emacs/atlas-llm-daemon.sh install-skill --user    # or: every session

# 2. A short name for attaching (add to your shell profile)
alias em='/path/to/atlas/emacs/atlas-llm-daemon.sh attach'

# 3. Optional preferences, read by every `attach` (environment variables
#    with the same names override them)
mkdir -p ~/.config/atlas-emacs
cat > ~/.config/atlas-emacs/env <<'CONF'
ATLAS_EMACS_BACKGROUND=dark   # or light; default: the COLORFGBG hint, else Emacs's guess
ATLAS_EMACS_THEMES=off        # disable your Emacs themes in this daemon
CONF

Requirements: Emacs 27 or newer, CIDER, clj-nrepl-eval, and Python 3 (used only to print results).

Using it

In Claude Code, run /atlas-emacs <intent>. When the LLM says the daemon is ready, run em in another terminal. em defaults to the current directory's project; use em --project <dir> for another one.

For each request the LLM offers two or three views, labeled by the question each one answers, and you pick one. Switch between the opened views with C-x t o. RET on any entity follows it.

Reviewing a branch

/atlas-review-branch <branch or PR> sets up a file-by-file review in the same frame. The LLM checks the branch out in its own git worktree, starts a REPL for it, and writes an org notebook with one entry per changed file: what changed, what to look at, and (when the project has an atlas registry) what the file registers and how many entities depend on it.

  • Index (review notes tab): one line per file, with TODO/DONE. RET opens a file.
  • File view (review tab): the file's diff, fully expanded, above its notes. RET on a diff line edits the real file at that line; C-c r b comes back to the diff.
  • Moving around: C-c r n / C-c r p next / previous file, C-c r d toggle DONE, C-c r o back to the index, C-c r r reset the layout.

On request it can also put the branch in "everything unstaged" form, on a new branch so the original and its PR stay untouched. The diff then shows what's left to accept: s / u stage and unstage hunks, and you make one commit at the end. The notebook and the saved commit messages live in ~/.local/state/atlas-emacs/reviews/, outside every repository. Nothing is pushed without your go-ahead.

What the script does

emacs/atlas-llm-daemon.sh is the only entry point. The LLM runs everything except attach:

CommandPurpose
repl --project DIRstart the project's nREPL with the cider-nrepl version your installed CIDER requires. If the project's dev alias starts the app, pass its source dirs with --extra-paths instead; --boot FORM runs a form once the REPL is up (e.g. loading the registry)
ensure --project DIRstart or reuse the daemon (one per project) and connect CIDER to that project's REPL
attach --project DIRopen your terminal frame (what em calls)
eval FORMevaluate elisp in the daemon (what the LLM uses to open layouts and read your screen)
statusthe daemon's project, git branch, REPL port and the REPL's working directory
listevery atlas daemon on this machine, with the same details
stopshut down a daemon (--socket PATH for one shown by list)
install-skill [--user]link the Claude Code skills (/atlas-emacs, /atlas-review-branch)

Each project directory gets its own daemon (the socket name includes a hash of the full path, so worktrees with the same folder name stay separate), and each daemon is connected to exactly one REPL.

The daemon is separate from your own Emacs server, and your preferences only apply inside it. The script never refreshes or reloads code in your REPL. When you work on the atlas repo itself, the LLM may load the core ontologies and an example registry into the REPL so the views have data.

Customization

;; Cache TTL (default 5 seconds)
(setq atlas--cache-ttl 10)

Running Emacs + Visual Explorer Together

For optimal development workflow, run both tools simultaneously:

Terminal 1 - CIDER REPL:

cd /path/to/atlas
clojure -M:dev

Emacs:

M-x cider-jack-in
;; Then initialize registry
;; Then press M-F to open atlas menu

Terminal 2 - Shadow-cljs (optional, for UI development):

cd ui
npx shadow-cljs watch atlas-ui    # or atlas-ui-v2 for v2

Browser - Visual Explorer:

  • After REPL starts, run: (ui/start! {:ui-version :v2})
  • Opens at http://localhost:8082 automatically

This gives you:

  • CIDER REPL for code execution and testing
  • Emacs for detailed entity inspection and analysis
  • Visual Explorer for graph visualization and team discussion
  • shadow-cljs watch (optional) for UI development with hot-reload

Limitations (PoC)

  • Emacs: Requires active CIDER connection
  • Emacs: No real-time updates (manual refresh needed)
  • Emacs: Jump-to-definition uses grep (not always accurate)
  • Visual Explorer: Limited to single-project registries
  • Visual Explorer: Presets not persisted across sessions
  • Both: No collaborative real-time features

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close