When Cody answers with generic Swift instead of referencing your actual code, its codebase context is not reaching the model. Here is how to diagnose and fix missing context in an iOS project.
The tell is answers that could apply to any Swift project. Cody talks about generic view models and networking instead of naming your real types and files.
This means the codebase context step is failing. The model is answering from general knowledge, not from your repository.
Context is Cody's core advantage, so this bug erases much of its value for iOS work in a large codebase.
The fixes below move from the most common causes, like the wrong folder open, to deeper ones like ignore rules and instance indexing.
The single most common cause is opening a subfolder instead of the project root. Cody's context is scoped to your open workspace.
Close the workspace and reopen the top-level directory that contains your whole app or Swift package, so all modules are visible.
For multi-repository work, make sure you are in the repo that actually holds the code you are asking about.
After reopening at the root, ask a code-specific question again and check whether Cody now names real files.
Open files heavily influence what Cody retrieves. Before asking, open the Swift file most relevant to your question.
Reference files or symbols explicitly in your prompt, for example 'In ProfileViewModel, why does load() fail silently?' Naming real symbols forces the right context.
Where your Cody interface supports attaching or mentioning files, use it to pin exact context into the conversation.
If generic answers become specific once you reference files directly, the underlying retrieval works and you mainly need to guide it.
Cody respects ignore configuration that excludes files from context. An overly broad rule can hide most of your Swift code.
Review any Cody ignore file or context filters in your project and instance. Confirm your source directories are not excluded.
Be careful with patterns that match broadly. A rule meant to exclude generated code can accidentally swallow real source folders.
After adjusting rules, reload the editor and retest, since context configuration is read at startup.
For enterprise setups, Cody's remote context depends on your repository being indexed on the Sourcegraph instance. If the repo is not synced, context will be thin.
Search for your repository in the Sourcegraph web UI. If it is missing or partially indexed, that explains generic answers.
A newly pushed or recently added repository may still be indexing. Give it time or ask an administrator to prioritize it.
Confirm you have permission to the repository on the instance. Access controls can quietly limit what context Cody may retrieve for you.
Too much irrelevant material can crowd out the files that matter. Close unrelated projects and stray tabs before asking focused questions.
If your workspace mixes several apps, split them so each session focuses on one codebase.
Exclude build artifacts, dependency checkouts, and generated files from context so retrieval favors your real Swift source.
A clean, focused workspace consistently yields more specific, accurate answers than a sprawling one.
Context features depend on an authenticated session with a plan that includes them. Confirm you are signed in and that your access is current after the 2025 plan changes.
If you switched instances, sign out and back in so Cody points at the correct context source.
Try rephrasing the question to be concrete and file-specific. Vague prompts invite vague, generic answers even when context is available.
If specificity and re-authentication together fix it, the earlier generic answers were a context-delivery issue, not a knowledge gap.
If answers stay generic after opening the root, referencing files, checking ignore rules, and confirming indexing, collect details for support.
Note whether the repo appears indexed in Sourcegraph, your instance URL, and example prompts that returned generic answers.
For enterprise deployments, involve your Sourcegraph administrator, since indexing and permissions are managed centrally.
Consult the official docs on context and ignore configuration, which describe exactly how retrieval is scoped and controlled.
Standardize on opening the repo root for Cody sessions across your team so no one fights missing context by accident.
Document your ignore rules and review them when adding new source directories, so real code never gets excluded.
Keep repositories indexed and permissions current on your instance as part of onboarding new projects.
With these habits, Cody's context stays reliable, and the generic-answer failure mode largely disappears.
To confirm whether context is reaching the model, ask a question whose answer you already know from the code. Name a specific type and ask what it does.
If Cody describes your real implementation, context is flowing. If it invents a plausible but wrong description, context is not reaching it.
This controlled check is faster than guessing, because you can immediately tell a retrieval failure from a mere phrasing problem.
Repeat the test after each fix so you know which change actually restored context rather than crediting the wrong step.
Cody can draw on both the files open in your editor and, on enterprise setups, repositories indexed on your Sourcegraph instance.
When local context alone is thin, opening the right Swift files and referencing them by name often fixes generic answers immediately.
When the question spans code not currently open, remote indexing matters, which is why an unindexed or unsynced repo produces vague replies.
Knowing which source a given answer should come from tells you where to look when context goes missing.
Large operations can leave Cody's view of your code out of date. A branch switch, a big merge, or a mass rename changes many files at once.
After such a change, reload the editor so the workspace and open files reflect the new state rather than the old one.
On enterprise setups, remember that remote indexing needs time to catch up with a freshly pushed branch, so very recent code may not be retrievable yet.
Giving indexing a moment, and reopening the root, usually restores specific answers after a disruptive change.
If it does not, fall back to referencing the exact files by name until the index catches up.
Building this reload-and-wait habit into your branch workflow prevents most stale-context confusion before it starts, and it costs only a few seconds each time.
Usually the context step is failing: you opened a subfolder instead of the repo root, an ignore rule excludes your source, or the repository is not indexed on your Sourcegraph instance.
Reference the file or symbol by name in your prompt, or attach it if your Cody interface supports mentioning files. Keeping that file open in the editor also strengthens context.
Yes. An overly broad Cody ignore pattern or context filter can exclude real source folders. Review your ignore configuration and make sure source directories are not matched.
For enterprise remote context, yes. Confirm the repo appears indexed in the Sourcegraph web UI and that you have permission to access it; a newly added repo may still be indexing.