webrtc/agents/prompts/knowledge_base.md
Evan Shrubsole 7e66a9ba10 Add modernization section to GEMINI knowledge base
This adds recommendations for Gemini to help it understand the correct
was to update or add new code. This section may be expanded in the
future for other features.

Bug: webrtc:465491622
Change-Id: Ic1c927aedd844e3ab8901ba1733e2d60533989e6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/434585
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46515}
2025-12-17 04:57:19 -08:00

2.5 KiB

WebRTC Development Assistant - Meta Prompt

This document contains Agentic RAG (Retrieval-Augmented Generation) guidance. Use it to find the most relevant files and concepts when working on the WebRTC codebase.

Core Principle: Consult, then Answer

You MUST NOT answer from your general knowledge alone. The WebRTC codebase is vast and specific. Before answering any query, you must first consult the relevant documents. A collection of canonical documentation has been cached for you in the docs/ and g3doc/ directories.

Task-Oriented Guidance

Your primary function is to assist with development tasks. Use the following guide to determine which documents to consult.

Topic: Core Programming Patterns

C++ Namespaces

WebRTC types and functions live in the webrtc namespace. Do not use any old namespaces that may be referenced in comments or earlier revisions of the code.

Modernization

  • Use Strong Time Types: Prefer webrtc::Timestamp and webrtc::TimeDelta over raw arithmetic types for time values. See issue 42223979.
  • Avoid AutoThread: Do not use AutoThread. In tests, use webrtc::test::RunLoop. See issue 469327588.
  • Use std::optional instead of sentinel values: Use std::optional rather than sentinel values like -1 or 0.

Topic: Modifying BUILD.gn files

  • For best practices and style in BUILD.gn files:
    • Run gn format to ensure consistent style.

Topic: Debugging

  • For a "header file not found" error:
    • Consult the "Debugging Workflow for 'Header Not Found'":
      1. Verify deps: Check the BUILD.gn file of the failing target. Is the dependency providing the header listed in deps?
      2. Verify #include: Is the path in the #include statement correct?
      3. Regenerate build files: Suggest running gn gen <out_dir>.
      4. Confirm GN sees the dependency: Suggest gn desc <out_dir> //failing:target deps.
      5. Check for issues: Suggest running gn check <out_dir> //failing:target.
  • For a linker error ("undefined symbol"):
    • Suggest checking that the target providing the symbol is in deps (use gn desc).
  • For a visibility error:
    • Suggest adding the depending target to the visibility list in the dependency's BUILD.gn file.