We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Ignoring Files

A great way to bloat context is to let OpenCode read giant chunks of noisy, irrelevant files.

Gitignore

OpenCode's content searches use ripgrep, which respects .gitignore patterns by default. This keeps ordinary searches from getting blasted by node_modules/ or dist/ folders. That said, explicit file patterns can override those exclusions, and the agent can still read ignored files directly if needed.

You don't really need anything AI-specific here. Just make sure you actually .gitignore generated files and dependencies like you normally would:

  • Build output (dist/, build/, generated assets)
  • Dependency trees (node_modules/, .venv/)
  • Large logs and temporary dumps
  • Binary blobs that won't help code reasoning

Ignore

You might want OpenCode searches to include a path covered by .gitignore, or to exclude a path without changing which files Git tracks. To override ripgrep's default search behavior, create a .ignore file in your project root:

!dist/
fixtures/xl-dump.json

The ! pattern re-includes dist/ in search results, while the regular pattern excludes fixtures/xl-dump.json.

Assignment

Tell OpenCode to add the Sloperator playground's logs/ directory to .gitignore and uv.lock to .ignore (so Git can still track it).

Then tell OpenCode to run and submit the CLI tests from the project root.