Skip to content

feat(cursor): add project-local tokensave integration - #5

Merged
ScriptedAlchemy merged 9 commits into
masterfrom
split/cursor-local-integration
Jun 7, 2026
Merged

feat(cursor): add project-local tokensave integration#5
ScriptedAlchemy merged 9 commits into
masterfrom
split/cursor-local-integration

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Summary

  • Add Cursor project-local MCP, rules, permissions, and hook setup generated by install --local --agent cursor.
  • Add Cursor hook handlers for session context, subagent guidance, prompt reset, targeted edit sync, shell/git freshness, and workspace-open sync.
  • Commit this repo's generated Cursor local config as dogfood installer output.

Test plan

ScriptedAlchemy added 2 commits June 7, 2026 10:32
Generate Cursor project rules, permissions, and supported hooks from the local installer so Cursor can prefer tokensave safely within a repo.
Add installer-generated Cursor project hooks for the local install:
- sessionStart: steer the Agent toward tokensave MCP tools and report index
  freshness (fire-and-forget).
- afterShellExecution: on Agent-run git checkout/switch/worktree add, bootstrap
  /maintain branch tracking via the shared library branch-add path (idempotent,
  no subprocess); other state-changing git commands run a coalesced incremental
  sync.
- workspaceOpen: ensure the current branch DB exists (branch add if missing) and
  run a catch-up incremental sync.

Performance: afterFileEdit now does a TARGETED single-file sync of only the
edited path(s) via sync_if_stale_silent (matcher "Write"), never a full-tree
scan, since scan cost scales with repo size not edit size and the Agent can
edit many files per turn.

All Cursor hooks are fail-open and only act when .tokensave/ exists. The
installer now reconciles its own hook entries on reinstall so refinements like
the afterFileEdit matcher reach pre-existing configs.

Caveat (documented): Cursor hooks only observe the Cursor Agent's own actions
and IDE lifecycle. Manual/external-terminal git checkout and in-place branch
switches are not seen (workspaceOpen does not fire for in-place checkout); the
git post-commit hook and on-demand MCP staleness check cover those.
@changeset-bot

changeset-bot Bot commented Jun 7, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 4385e31

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a4d5ea33dd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/hooks.rs
Comment thread .cursor/hooks.json
ScriptedAlchemy added 4 commits June 7, 2026 10:47
Avoid treating single-file checkout restores as branch switches so Cursor hooks run normal sync instead of creating bogus branch tracking.
Merge the Windows path expectation fix while preserving Cursor local install test exclusions.
@ScriptedAlchemy
ScriptedAlchemy changed the base branch from split/local-install-foundation to master June 7, 2026 14:31
@ScriptedAlchemy
ScriptedAlchemy merged commit 62208a3 into master Jun 7, 2026
5 checks passed
@ScriptedAlchemy
ScriptedAlchemy deleted the split/cursor-local-integration branch July 4, 2026 01:13
spa5k pushed a commit to spa5k/tracedecay that referenced this pull request Jul 4, 2026
Flake ScriptedAlchemy#5: the codex app-server / model backend tests (the success-path
`codex_app_server_*` / `fake_codex_app_server_*` cases) flaked under
parallel execution.

`fake_codex_response_timeout()` was 5s on non-Windows — the budget for the
fake codex child (a real python interpreter) to spawn and complete its
scripted turn. Under process-per-test parallelism that spawn can be
scheduled slowly enough to exceed 5s, yielding a spurious "timed out waiting
for codex app-server response".

Fix (test only): use a uniform generous 30s success-path budget (matching
the prior Windows value). Tests that deliberately exercise the timeout path
pass their own tight `Duration` (e.g. 300ms) and are unaffected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant