Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

The AI Canary Test: Stop Your Assistant From Trusting the Whole Repo

说明与用途

“金丝雀”测试可验证 AI 助手是否遵守范围限制,防止其读取过时或错误文件并节省令牌。

问题

AI assistants often read entire repositories, trusting all content, including outdated or false information, leading to incorrect answers and token overuse.

结果

The canary test reveals whether an AI assistant respects scoped context. By planting a false fact and observing the assistant’s response, developers can enforce token budgets and prevent the assistant from accessing unintended files.

工作流

  • 1. Create a hidden file .ai-context/canary.md with a false claim and do not commit it.
  • 2. Ask the assistant a question that can be answered only by reading the canary file to test scope.
  • 3. Build a scoped prompt using scoped-prompt.sh, providing goal, current diff, and whitelisted files within a token budget.
  • 4. Run the script to generate a prompt that excludes the canary file.
  • 5. Send the generated prompt to an OpenAI-compatible endpoint via curl and jq.
  • 6. Verify the assistant responds with uncertainty instead of the false claim.

证据

A canary is a small lie planted in the repo. It lives in a file the assistant should never need.

来源

Feed the assistant only three things: the goal, the current diff, and whitelisted files.

来源

  • 记录日期: 2026-09-08T13:45:40.163Z