infraphysics//Localhost Editor

A CodeMirror-based editor that only activates on localhost — invisible in production. Allows editing fieldnotes in the browser using the full custom syntax, with live recompilation.


A CodeMirror-based editor that only activates on localhost — invisible in production. Allows editing fieldnotes in the browser using the full custom syntax, with live recompilation.

Detected via useIsLocalhost — when the site runs on localhost:5173, the editor panel appears inside the Second Brain UI

The editor is a CodeMirror instance with syntax-aware features: typing double-bracket triggers wiki-link autocomplete (fuzzy-matches names, aliases, addresses), unlinked term detection highlights concepts that should be wiki-links, and diagnostics catch structural issues (missing parents, broken refs)

On save (Ctrl+S): the editor POSTs the raw markdown to a local endpoint on the Vite dev server → the server writes the .md file back to disk → HMR detects the file change → the compiler recompiles that single note → the browser fetches the fresh .json → the rendered note updates in place

The full cycle (edit → save → see rendered result) takes under a second

The editor doesn't compile anything itself. It's a comfortable interface for writing markdown that respects the custom syntax rules — the compilation always happens through the same build pipeline, whether the edit came from CodeMirror, Claude Code, or a text editor.