# Subfolder workspace still retrieves parent-folder

**URL:** <https://forum.cursor.com/t/subfolder-workspace-still-retrieves-parent-folder/159330>\
**Category:** Help\
**Tags:** context, indexing\
**Created:** [April 29, 2026, 8:50am UTC](https://forum.cursor.com/t/subfolder-workspace-still-retrieves-parent-folder/159330 "2026-04-29T08:50:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nils](https://avatars.discourse-cdn.com/v4/letter/n/d6d6ee/32.png) [@nils](https://forum.cursor.com/u/nils)\
**Post date:** [April 29, 2026, 8:50am UTC](https://forum.cursor.com/t/subfolder-workspace-still-retrieves-parent-folder/159330/1 "2026-04-29T08:50:58Z")

</div>

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:

```auto
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:

```auto
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:

- Second prompt:

### 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

---

<div class="post-metadata">

**Author:** ![mohitjain](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/mohitjain/32/100229_2.png) [@mohitjain](https://forum.cursor.com/u/mohitjain)\
**Post date:** [April 29, 2026, 11:27am UTC](https://forum.cursor.com/t/subfolder-workspace-still-retrieves-parent-folder/159330/6 "2026-04-29T11:27:50Z")

</div>

Hey @nils,

1. Retrieval scope

When you open only `subfolder/` as your workspace, Cursor’s [codebase indexing](https://cursor.com/docs/agent/tools/search) 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.

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/system/32/99069_2.png) [@system](https://forum.cursor.com/u/system)\
**Post date:** [May 1, 2026, 11:28am UTC](https://forum.cursor.com/t/subfolder-workspace-still-retrieves-parent-folder/159330/7 "2026-05-01T11:28:18Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
