Skip to content

armgit / ECC

Public Imported from GitHub
0

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

fix: avoid cursor nested AGENTS context pollution

Affaan Mustafad49f0329a9d0
diff --git a/scripts/lib/install-targets/cursor-project.js b/scripts/lib/install-targets/cursor-project.js
index 66fd19df3..617bbcc09 100644
--- a/scripts/lib/install-targets/cursor-project.js
+++ b/scripts/lib/install-targets/cursor-project.js
@@ -133,6 +133,12 @@ module.exports = createInstallTargetAdapter({
destinationPath: path.join(targetRoot, 'mcp.json'),
});
+ if (sourceRelativePath === 'AGENTS.md') {
+ // Cursor treats nested AGENTS.md files as directory context; do not
+ // install ECC's root project identity into a host project's .cursor/.
+ return [];
+ }
+
if (sourceRelativePath === 'rules') {
return takeUniqueOperations(createFlatRuleOperations({
moduleId: module.id,
diff --git a/tests/lib/install-targets.test.js b/tests/lib/install-targets.test.js
index e0908a62e..98c021dcd 100644
--- a/tests/lib/install-targets.test.js
+++ b/tests/lib/install-targets.test.js
@@ -172,6 +172,36 @@ function runTests() {
);
})) passed++; else failed++;
+ if (test('does not install root AGENTS.md into Cursor nested context', () => {
+ const repoRoot = path.join(__dirname, '..', '..');
+ const projectRoot = '/workspace/app';
+
+ const plan = planInstallTargetScaffold({
+ target: 'cursor',
+ repoRoot,
+ projectRoot,
+ modules: [
+ {
+ id: 'agents-core',
+ paths: ['.agents', 'agents', 'AGENTS.md'],
+ },
+ ],
+ });
+
+ assert.ok(
+ !plan.operations.some(operation => (
+ normalizedRelativePath(operation.sourceRelativePath) === 'AGENTS.md'
+ )),
+ 'Cursor installs should not copy ECC root AGENTS.md into host project context'
+ );
+ assert.ok(
+ !plan.operations.some(operation => (
+ operation.destinationPath === path.join(projectRoot, '.cursor', 'AGENTS.md')
+ )),
+ 'Cursor installs should not create .cursor/AGENTS.md'
+ );
+ })) passed++; else failed++;
+
if (test('plans cursor platform rule files as .mdc and excludes rule README docs', () => {
const repoRoot = path.join(__dirname, '..', '..');
const projectRoot = '/workspace/app';