Skip to content

Large Projects

VJSP can be used with projects of any size, but special attention to context management is required when working with large codebases. Below are some tips for handling large repositories:

Understanding Context Limits

The large language models (LLMs) used by VJSP have a limited "context window." This is the maximum amount of text (measured in tokens) the model can process at once. If the context becomes too large, the model may fail to understand your request or generate accurate responses.

The context window includes:

  • System prompts (VJSP's instructions).
  • Conversation history.
  • Contents of any files you reference using @.
  • Output from any commands or tools used by VJSP.

Strategies for Managing Context

  1. Be Specific: When referencing files or code, use exact file paths and function names. Avoid vague references like "the main file."

  2. Use Context Mentions Effectively: Use @/path/to/file.ts to include specific files. Use @problems to include current errors and warnings. Use @ followed by a commit hash to reference a specific Git commit.

  3. Break Down Tasks: Split large tasks into smaller, more manageable subtasks. This helps keep the context focused.

  4. Summarize: If you need to reference a large amount of code, consider summarizing the relevant parts in your prompt instead of including the entire code.

  5. Prioritize Recent History: VJSP automatically truncates older messages in the conversation history to stay within the context window. Keep this in mind and re-include important context when needed.

  6. Use Prompt Caching (if available): Some API providers—such as Anthropic, OpenAI, OpenRouter, and Requesty—support "prompt caching." This caches your prompt for future tasks, helping reduce cost and latency.

Example: Refactoring a Large File

Suppose you need to refactor a large TypeScript file (src/components/MyComponent.tsx). Here’s a possible approach:

  1. Initial Overview:

    @/src/components/MyComponent.tsx List the functions and classes in this file.
  2. Target a Specific Function:

    @/src/components/MyComponent.tsx Refactor the `processData` function to use `async/await` instead of Promises.
  3. Iterate Changes: Make small, incremental changes and review/approve each step.

By breaking down tasks and providing precise context, you can effectively work with large files—even within a limited context window.