- Node.js >= 18.0.0 (for CCEM core TypeScript components)
- Elixir >= 1.14 with OTP >= 25 (for APM v4 Phoenix server)
- Python 3.x (for APM v3 fallback, optional)
- jq (used by session_init.sh for JSON manipulation)
cd ~/Developer/ccem/apm-v4
mix deps.get
mix compilecd ~/Developer/ccem/apm-v4
mix phx.serverThe server starts on port 3032. Open http://localhost:3032 to access the dashboard.
In normal operation, you do not need to start the server manually. The session_init.sh hook automatically starts it when a Claude Code session begins:
- Claude Code fires the SessionStart hook
session_init.shchecks if port 3032 is occupied- If not, it runs
mix phx.serverin the background with output redirected to~/Developer/ccem/apm/hooks/apm_server.log - PID is written to
~/Developer/ccem/apm-v4/.apm.pid - The hook waits 3 seconds for the server to initialize, then confirms via port check
# Via PID file
kill $(cat ~/Developer/ccem/apm-v4/.apm.pid)
# Or find the process
lsof -ti:3032 | xargs killcd ~/Developer/ccem/apm-v4
mix testExpected output: 233 tests, 0 failures.
When a new Claude Code session starts:
1. Claude Code fires SessionStart hook
|
2. session_init.sh receives JSON payload (session_id, cwd)
|
3. Derives project_name from basename of cwd
|
4. Checks if APM server is running (PID file + port check)
| |
| (not running) | (running)
v v
5a. Starts Phoenix 5b. Skip
|
6. Writes ~/Developer/ccem/apm/sessions/{session_id}.json
|
7. Upserts project into apm_config.json:
- If project exists: append session to sessions array
- If new project: add to projects array with session
- Updates active_project to current project name
|
8. POST http://localhost:3032/api/config/reload
|
9. APM server re-reads config, discovers new session
|
10. Dashboard updates in real-time via PubSub/LiveView
APM v4 supports monitoring multiple projects simultaneously through a single server instance.
Projects are registered automatically when a Claude Code session starts in their directory. No manual configuration is needed. The session_init.sh hook handles everything:
- Opening a Claude Code session in
/Users/jeremiah/Developer/ccemregisters a project namedccem - Opening a session in
/Users/jeremiah/tools/@yj/lfgregisters a project namedlfg - Each subsequent session in the same directory appends to the existing project's sessions array
- Landing page (
http://localhost:3032): Shows a card grid of all registered projects with session counts, agent counts, and Ralph progress. - Project dashboard (
http://localhost:3032/project/{name}/): Shows the full dashboard scoped to a single project (v3 Python server route). - All Projects LiveView (
http://localhost:3032/apm-all): Phoenix LiveView overview of all projects (v4).
The active_project field in apm_config.json determines which project is shown by default. It is automatically updated when a new session starts. You can also switch manually:
# Via API
curl -X POST http://localhost:3032/api/config/reload
# Or edit apm_config.json directly and reload
jq '.active_project = "my-project"' ~/Developer/ccem/apm/apm_config.json > /tmp/cfg.json && \
mv /tmp/cfg.json ~/Developer/ccem/apm/apm_config.json && \
curl -X POST http://localhost:3032/api/config/reloadMost API endpoints accept ?project=<name> to scope data to a specific project:
# Get data for a specific project
curl http://localhost:3032/api/data?project=ccem
# Discover agents for a specific project
curl http://localhost:3032/api/agents/discover?project=lfgcd ~/Developer/ccem
npm installnpm run build# Via npm script
npx ccem tui
# Or after global install
npm install -g .
ccem merge --strategy recommended --config ./proj1/.claude ./proj2/.claudenpm test # Run all tests
npm run test:coverage # With coverage report
npm run typecheck # Type checking only
npm run lint # LintingThe Python v3 server can be used as a fallback if Elixir is not available:
cd ~/Developer/ccem/apm
python3 monitor.pyThis serves the same dashboard on port 3032 with identical API endpoints. The v3 server reads the same apm_config.json and supports the v4 multi-project format with backward compatibility for the v3 flat format.
cd ~/Developer/ccem
npm run ui:dev # Development server
npm run ui:build # Production build
npm run ui:test # Run UI testsA native macOS menubar application at ~/Developer/ccem/CCEMAgent/. Build and launch:
cd ~/Developer/ccem/CCEMAgent
swift build -c release
open -a CCEMAgentFeatures:
- Connection state indicator (connected / connecting / disconnected)
- Project count and active session display
- Start/Stop APM server from disconnected state
- Telemetry usage chart
- Background task monitor with logs
- Docker socket repair
- Launch at login toggle
# Check if port is in use
lsof -ti:3032
# Check the log
tail -50 ~/Developer/ccem/apm/hooks/apm_server.log
# Check Elixir deps
cd ~/Developer/ccem/apm-v4 && mix deps.get# Check hook log
tail -20 ~/Developer/ccem/apm/hooks/apm_hook.log
# Check config was updated
cat ~/Developer/ccem/apm/apm_config.json | jq '.projects | length'
# Manually trigger reload
curl -X POST http://localhost:3032/api/config/reloadDocker Desktop on macOS can lose its socket symlink after crashes. CCEM includes built-in repair tools.
Symptoms:
docker inforeturns "Cannot connect to the Docker daemon"- Docker Desktop shows "Engine running" but containers show errors
ls ~/.docker/run/docker.sockreturns "No such file"
Fix via Claude Code skill:
/docksock # Auto-detect and repair
/docksock status # Check socket health
/docksock restart # Full Docker restart + repairFix via CLI:
ccem docksock status # Check health
ccem docksock repair # Auto-repair
ccem docksock restart # Full restartFix via CCEMAgent: The menubar app shows "Repair Docker Socket" when the socket is broken. Click to auto-repair.
Manual fix:
ln -sf ~/Library/Containers/com.docker.docker/Data/docker.raw.sock ~/.docker/run/docker.sockSee Docker Socket Repair wiki page for full details.
The /ccem apm slash command provides management operations:
| Command | Description |
|---|---|
/ccem apm init |
Initialize/re-register current session |
/ccem apm start |
Start APM server |
/ccem apm stop |
Stop APM server |
/ccem apm open |
Open dashboard in browser |
/ccem apm restart |
Restart APM server |
/ccem apm refresh |
Reload config |
/ccem apm status |
Show server status |
/ccem apm manage all |
Show all management info |
/ccem apm manage sessions |
List sessions |
/ccem apm manage cleanup |
Clean stale sessions |