feat: Cursor-independent ECC memory via ECC_AGENT_DATA_HOME (#2066)

* feat: auto-isolate ECC memory data for Cursor via ECC_AGENT_DATA_HOME

Add ECC_AGENT_DATA_HOME (defaults to ~/.claude) with Cursor-aware resolution,
sessionStart env injection, install scaffolds, and hook bootstrap so memory
hooks do not collide with Claude Code when both harnesses are used.

Closes #2065

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: log agent-data config errors and ship cursor sessionStart deps

Address CodeRabbit review: log invalid .cursor/ecc-agent-data.json parse
failures, and copy cursor-session-env.js plus lib deps on legacy Cursor
install so sessionStart hook path exists without hooks-runtime alone.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: resolve relative agentDataHome paths from project root

Project config values like ".ecc-data" now resolve against the
repository root (parent of .cursor/), not process.cwd(), so Cursor
hooks persist memory in the intended directory regardless of hook cwd.

Addresses cubic review on PR #2066.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: explain getHomeDir duplicate and docstring policy

Document why agent-data-home keeps a local home-dir helper (circular
require with utils.js) and list consolidation options for maintainers.
Note that CodeRabbit JSDoc coverage warnings are informational relative
to ECC's usual script documentation style.

Addresses cubic P2 context on PR #2066.

Co-authored-by: Cursor <cursoragent@cursor.com>

* test: isolate agent-data-home tests from dogfooded .cursor config

Use isolated temp cwd for default-resolution cases and assert
resolveAgentDataHome({ projectDir }) reads ecc-agent-data.json.
Document cwd/project caveats in the test file header.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Tom Cruise Missile
2026-06-06 23:27:00 -06:00
committed by GitHub
parent 81c9150512
commit 6a40469408
15 changed files with 749 additions and 19 deletions

View File

@@ -15,19 +15,25 @@ export const isLinux: boolean;
/** Get the user's home directory (cross-platform) */
export function getHomeDir(): string;
/** Get the Claude config directory (~/.claude) */
/**
* ECC agent data root for memory persistence and related state.
* Defaults to ~/.claude; override with ECC_AGENT_DATA_HOME (e.g. ~/.cursor/ecc).
*/
export function getAgentDataHome(): string;
/** Get the agent data directory (alias of getAgentDataHome) */
export function getClaudeDir(): string;
/** Get the canonical ECC sessions directory (~/.claude/session-data) */
/** Get the canonical ECC sessions directory ($ECC_AGENT_DATA_HOME/session-data) */
export function getSessionsDir(): string;
/** Get the legacy Claude-managed sessions directory (~/.claude/sessions) */
/** Get the legacy sessions directory ($ECC_AGENT_DATA_HOME/sessions) */
export function getLegacySessionsDir(): string;
/** Get session directories to search, with canonical storage first and legacy fallback second */
export function getSessionSearchDirs(): string[];
/** Get the learned skills directory (~/.claude/skills/learned) */
/** Get the learned skills directory ($ECC_AGENT_DATA_HOME/skills/learned) */
export function getLearnedSkillsDir(): string;
/** Get the temp directory (cross-platform) */