Tutorial 4 Repo context (BYOK)

Using codebase context

Bring in a few relevant files when the problem is tied to a real project and not just a generic task. This tutorial shows how to attach repo context so your refinement stays grounded in your actual naming conventions, types, and patterns.

Time ~10 minutes
What you need A project with at least a few source files. Free account or above.
What you'll learn How to attach files, filter context, and see what changes with repo grounding.
Using RyFine's managed provider (RyFine ✦)? You don't need this manual flow — RyFine ✦ automatically detects a RyFineCI.md file in your repo instead. See Creating a RyFineCI.md for that path. This tutorial covers manually attaching files, which applies when you're using your own API key (BYOK), Ollama, or Browser AI.

Write a prompt that is tied to your actual codebase

Generic prompts work fine without context. Context makes a difference when the task requires knowledge of your project's specific patterns. Good examples:

  • Refactoring a module to follow your existing conventions
  • Writing a new service that matches your current data model
  • Updating docs or migration guides that need to reflect real code
  • Code review prompts that check against your team's standards

For this tutorial, use a real task from whatever project you're currently working on. Something like: "refactor the auth middleware to use the new token format". Don't add project details yet — that's what context is for.

Open the Context panel

Click Context in the RyFine toolbar. You'll see three ways to attach files:

  • Upload files directly — drag and drop individual files or select them from your machine.
  • Scan a local Git folder — point RyFine at a directory; it reads the file tree and filters out node_modules, build output, and any paths in your .gitignore.
  • Import a GitHub repo — connect via GitHub to browse and import files from a remote repository without cloning.

All three options keep files local to your browser session — nothing is uploaded to RyFine's servers.

Select only the files that define the pattern

This is the most important step. More context is not better — it increases token usage and dilutes the signal. Aim for 2–4 files that are directly relevant to the task:

  • The source file being modified or extended
  • A type or interface definition the new code needs to match
  • A sibling file that shows the pattern you want to follow

Toggle files on and off using the checkbox next to each one. RyFine shows the total character count so you can see how much context you're adding.

Repo context — select files
✓ src/middleware/auth.ts 3.1 KB
✓ src/types/token.ts 1.4 KB
– src/middleware/rateLimit.ts 2.8 KB
– README.md 4.6 KB
Rule of thumb: if removing a file from the selection wouldn't change what a good answer looks like, leave it out. Fewer, more relevant files produce tighter refinements than a broad dump of the whole repo.

Run the refinement with context attached

With your files selected, run the refinement using your configured provider. Your prompt, plus the selected file snippets, is sent to the model together. The refinement now has access to:

  • Your specific type names and interfaces
  • Your naming conventions and code style
  • The structure and patterns already present in your codebase

A grounded refinement will reference your actual code — using your real type names, your function signatures, your variable conventions — instead of generic placeholders.

Run the same prompt without context and compare

Toggle all files off and hit RyFine again on the same prompt. Read both outputs side by side:

  • The version without context will use generic terms and placeholders.
  • The version with context will reference your real types, your structure, your patterns.

This comparison makes the value of repo context concrete. Use it once to build intuition for how much difference a few well-chosen files make.

Combine with compare mode: if you have a free account, enable A/B compare while context is attached to see how two different models use the same files. Often one model extracts and applies repo context more precisely than the other.

Reuse context across a project

Once you've loaded a set of files, they stay available for the rest of your session. If you're working through several related prompts — a migration plan, a code review, an implementation brief — you don't need to re-attach files each time.

Save the context-grounded refinements to a Project to build up a history of prompts that reflect your codebase. RyFine uses those previous inputs and outputs as few-shot examples on subsequent runs, which means the model progressively learns what good output looks like for your specific project.