Repository navigation
fix(cursor): the hooks find the installed runtime and sessionStart restores the project memory - #2215
Conversation
…es the project memory The install copies the runtime under .cursor/scripts while the Cursor hooks looked for it two levels up, so in an installed project the session start, the push after a response, the GateGuard and the dev server block did nothing. The new scripts/hooks/cursor-session-start.js runs the shared session adapter with the workspace root, pulls the Team Brain when the team asks for it and answers the memory as additional_context. The shared adapter takes a payload a host wrapper already read. Signed-off-by: Felipe Marzochi <fmarzochi@gmail.com> # Conflicts: # docs/VISION.md # scripts/lib/session-start-adapter.js
# Conflicts: # CHANGELOG.md # docs/VISION.md Signed-off-by: Felipe Marzochi <fmarzochi@gmail.com>
…stores the project memory egc install --target cursor copies the runtime under .cursor/scripts, while the hooks in .cursor/hooks looked for it two levels up, where only the EGC repository has it, so in an installed project the session start, the push at the end of a response, the GateGuard and the dev server block did nothing. The adapter resolves each script in the installed layout first and in the repository layout second, sessionStart runs the shared session adapter and answers the project memory as additional_context, and stop pushes the Team Brain after a turn that changed the state. Signed-off-by: Felipe Marzochi <fmarzochi@gmail.com>
There was a problem hiding this comment.
All reported issues were addressed across 14 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
…layout # Conflicts: # CHANGELOG.md Signed-off-by: Felipe Marzochi <fmarzochi@gmail.com>
…ull and the push went through, and the docs state the push gate The stop hook ran the push twice, once through session-end.js and once through cursor-stop.js, so the second file now answers nothing and says why. The two sync cases run against a bare remote of their own through egc team init, assert the ok outcome in the autosync log, check the memory is still answered with the team on, prove a turn that changed nothing pushes nothing, and clean team.json in a finally. VISION and integration-tiers say the push happens on the first run and then only when a state document changed. Signed-off-by: Felipe Marzochi <fmarzochi@gmail.com>
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…he layout test resolves the real temporary path cursor-stop.js is the push again, through the shared team-sync-stop.js, behind the stop:team-brain gate of the Cursor stop hook, and session-end.js leaves the push to it when the payload comes from the Cursor adapter, so disabling one gate never disables the other hook. The layout test resolves the real path of the temporary folder, which on macOS is a link, and the unchanged-turn check counts every push attempt, not only the ones that went through. Signed-off-by: Felipe Marzochi <fmarzochi@gmail.com>
…layout # Conflicts: # CHANGELOG.md Signed-off-by: Felipe Marzochi <fmarzochi@gmail.com>
…ile of the project with the same name and that each stop gate controls its own push The installed project now carries a scripts/hooks/session-start.js of its own, which the repository layout would reach two levels up from the hooks, so an inverted precedence fails the case; the repository layout is proved on an isolated copy under the temporary folder instead of this checkout. The stop case rewrites the state document the way a turn would, making it writable first (the server keeps a synced document read-only), runs the hook with the Team Brain gate off and asserts no push is attempted, then with the session record gate off and asserts the push happens by itself; the hooks outside the case stay off so the cost tracker writes nothing under the checkout. Signed-off-by: Felipe Marzochi <fmarzochi@gmail.com>
There was a problem hiding this comment.
All reported issues were addressed across 1 file (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
…hy the write bit is restored update_state writes a fresh file and renames it over the old one, with no chmod; the test restores the write bit because writeFileSync needs it on a document the server publishes read-only. Signed-off-by: Felipe Marzochi <fmarzochi@gmail.com>
|



What
egc install --target cursorcopies the runtime under.cursor/scriptsof the project, while the hooks in.cursor/hookslooked 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.egc-memory-load.jsandegc-memory-save.js, which wrote a field Cursor does not read) leave the tree.Phase 1 of the Team Brain plan. The hook files of
.cursor/hookswere 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).Summary by cubic
Fixes the Cursor hooks that
egc install --target cursorsets 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..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.stophook runs exactly one Team Brain push per turn throughcursor-stop.jsbehind thestop:team-braingate, withsession-end.jsdeferring to it for Cursor payloads.egc-memory-load.jsandegc-memory-save.jshooks are removed, and the docs no longer claim Cursor cannot inject context.Written for commit 601cf0d. Summary will update on new commits.