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

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

Description and use

The Canary Test checks if an AI assistant respects scoped context, preventing it from reading stale or false files and saving tokens.

Problem

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

Outcome

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.

Workflow

  • 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.

Evidence

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

Source

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

Source

  • Record date: 2026-09-08T13:45:40.163Z