Subfolder workspace still retrieves parent-folder

Hello Cursor team,

I’m trying to understand how AI context scoping and retrieval works in Cursor, and I’ve observed behavior that I’d like clarification on.

Setup

I tested a simple local TypeScript project:

project/
  utils.ts
  subfolder/
    index.ts

I opened only subfolder/ as a workspace (not the project root).

What I tested

1. With an import

In subfolder/index.ts, I imported a helper from the parent folder:

import { helper } from "../utils";

When I then asked:

“is there another helper function I can use?”

Cursor suggested additional helper functions from utils.ts.

2. Without any imports

I removed all imports to parent folders and tested two prompts:

  • First prompt:

    “is there another helper function I can use?”

    -> Cursor did not surface parent-folder utilities.

  • Second prompt:

    “is there a helper function in a parent folder?”

    -> Cursor then correctly surfaced functions from ../utils.ts.

My question

Could you clarify how retrieval scope and AI context selection works in these cases?

Specifically:

  1. When only a subfolder is opened, is AI retrieval strictly limited to that folder, or can it still access files outside it?

  2. How does query phrasing (e.g. mentioning “parent folder”) influence what the AI searches or retrieves?

I’m trying to understand how deterministic or scoped Cursor’s AI context is when working in subfolder-based workflows, and how much query wording affects what parts of the codebase are considered.

Thanks

Hey @nils,

1. Retrieval scope

When you open only subfolder/ as your workspace, Cursor’s codebase indexing is scoped to that folder. Only files inside subfolder/ are indexed for semantic search.

However, the AI agent has tools beyond the index — it can read files by path, run grep, and use terminal commands. So when your file has import { helper } from "../utils", the agent follows that concrete path reference and reads ../utils.ts directly, even though it’s outside the workspace. That’s why it found additional helpers in the import case.

2. How query phrasing matters

There’s no keyword detection for phrases like “parent folder.” What happens is the AI model interprets your natural language and decides which tools to call and with what arguments. When you ask “is there a helper function in a parent folder?”, the model treats that as a cue to look outside the current directory — it may use its read or grep tools with ../ paths. Without that cue, it stays within the indexed workspace scope.

So in short: the index is workspace-bounded, but the agent’s tools can reach outside it when given a reason to — either through an explicit import reference or a prompt that asks about files outside the workspace.