fix(cursor): the hooks find the installed runtime and sessionStart restores the project memory
What
egc install --target cursor copies the runtime under .cursor/scripts of the project, while the hooks in .cursor/hooks looked for it two levels up, where only the EGC repository has it. In an installed project the session start, the push at the end of a response, the GateGuard and the dev server block did nothing and said nothing.
adapter.jshasresolveRuntimePath: the installed copy (.cursor/scripts/...) when it exists, the repository layout (scripts/...) otherwise;getPluginRootis.cursor;runExistingHookruns the hook through it and can hand its stdout back.session-start.jsrunsscripts/hooks/cursor-session-start.js(the shared session-start adapter, hostcursor: Team Brain pull when the team asks for it, state restored, telemetry) and answers Cursor withadditional_contextholding the project memory, nothing else: the payload is no longer echoed back as the answer.stop.jsadds the Team Brain push ofscripts/hooks/cursor-stop.jsafter the turn, when a state file changed since the last run, the way Claude's Stop hook pushes.before-tool-use.jsloads the GateGuard andbefore-shell-execution.jsthe shell splitter throughresolveRuntimePath.- The two memory hooks no hook configuration ever called (
egc-memory-load.jsandegc-memory-save.js, which wrote a field Cursor does not read) leave the tree. - VISION, TEAM-BRAIN and integration-tiers no longer say that the Cursor hook cannot inject context.
Phase 1 of the Team Brain plan. The hook files of .cursor/hooks were placed by the maintainer, as the Guardian asks for a hook surface.
Test plan
-
tests/hooks/cursor-installed-layout.test.js(new): an installed project built from.cursor/hooksplusscripts/hooksandscripts/libunder.cursor/scripts; the adapter resolves the installed runtime and the repository runtime;sessionStartanswers JSON with the memory asadditional_context, runs the Team Brain pull whenteam.jsonasks for it, answers{}with no memory;stopruns the push after a turn that changed the state;preToolUsedenies the first Write through the GateGuard;beforeShellExecutionblocks a dev server outside tmux (7 passed). -
tests/hooks/cursor-gateguard.test.js,cursor-guardian-adapter.test.js,cursor-crusher-adapter.test.jsstill pass (19, 12 and 10). - eslint clean, local gate clean (repository eslint, Sonar rules, duplication).
Summary by cubic
Fixes the Cursor hooks that egc install --target cursor sets up: they looked for the EGC runtime scripts two levels up, where only the repository has them, so in an installed project the session start, the Team Brain push, the GateGuard, and the dev server block silently did nothing.
- Each runtime script now resolves to the installed layout (
.cursor/scripts/...) first and the repository layout (scripts/...) second, so an installed copy wins over a project file of the same name. sessionStartruns the shared session adapter, pulls the Team Brain when the team asks for it, and answers Cursor with the project memory asadditional_context; the input payload is no longer echoed back as the answer.- The
stophook runs exactly one Team Brain push per turn throughcursor-stop.jsbehind thestop:team-braingate, withsession-end.jsdeferring to it for Cursor payloads. - The never-configured
egc-memory-load.jsandegc-memory-save.jshooks are removed, and the docs no longer claim Cursor cannot inject context.