codemap
codemap copied to clipboard
[codex] prototype codemapd sidecar using sockd
Summary
This opens the first real sockd adoption inside codemap.
What is in this prototype:
- add a Rust
codemapdsidecar built onsockd::Daemon - add a pure-Go
sockdframe client for hook/context/serve reads - prefer socket-backed cached state where available, with fallback to
.codemap/state.json - start
codemapdduring hook sessions and shut it down on session stop when the sidecar is discoverable
This is intentionally the mirrored-state variant for the first pass: the Go watch daemon still owns .codemap/state.json, and codemapd caches and serves slices of that state over the socket.
What Works Now
- real library adoption:
codemapdis built onsockd, not a reimplementation of the protocol - no cgo requirement: the Go side speaks the frame protocol directly
- backward compatibility: reads still fall back to
state.jsonif the daemon is unavailable - local validation is green:
go test ./...cargo testincodemapd- smoke test with
session-start,pre-edit, andsession-stop
Current Limits
codemapdcurrently depends on a local siblingsockdcheckout- sidecar discovery is currently
CODEMAPD_BINor a siblingcodemapdbinary - this does not yet change release packaging or installation flows
- Windows remains effectively unsupported for this path until
sockdhas a Windows transport story - the watch daemon is still the source of truth; this is not the final end-state architecture yet
Checklist For Full Implementation
- [ ] replace the local
sockdpath dependency with the publish/install strategy we actually want - [ ] define the packaged install and discovery story for
codemapd - [ ] wire
codemapdinto release artifacts and installer flows - [ ] add focused tests for socket-backed reads and daemon lifecycle behavior from the Go side
- [ ] decide which command paths should auto-start
codemapdvs remain opportunistic - [ ] measure hook latency before and after this path and document the delta
- [ ] decide whether to keep the mirrored-state variant or move to a direct worker-backed daemon model
- [ ] define the Windows behavior explicitly, even if that means feature-gating this path for now