Engineering Deep DivePublished on August 12, 20267 min read

TreeSift: turning agent context into an auditable artifact

The hard part of sending a repository to an AI is not compressing files; it is controlling selection, provenance, secrets and repeatability of the context handed to the agent.

  • AI Engineering
  • Context Engineering
  • Security
  • Python
  • View related project

    The common way to send code to an AI is still manual file selection, a ZIP, or pasted snippets. That flow hides important decisions: what was excluded, which commit produced the context, whether secrets were present and whether the same selection can be reproduced later.

    TreeSift treats that handoff as an engineering artifact. The goal is not to magically choose what the AI should read, but to make selection deterministic, explainable and verifiable.

    Four mechanisms hold that design together:

    • Deterministic selection with ignore rules evaluated in the correct directory scope
    • Git provenance, hashes and manifests that reconstruct the handoff state
    • Conservative policies for secrets, binaries and sensitive local files
    • An explicit boundary between repository data and files containing instructions for agents

    A central architectural decision was to avoid a classifier that decides which files are 'important'. That can feel convenient, but it creates hidden behavior and makes exclusion decisions hard to explain. TreeSift keeps selection controlled by observable rules.

    The same selection core powers context bundles and ZIP/TAR archives. That avoids two definitions of what belongs to the project and reduces drift between what is analyzed and what is packaged.

    Snapshots and deltas let later interactions send only changes since a prior handoff. The benefit is not only token reduction; it preserves provenance across project states.

    Should context engineering be treated as prompt engineering, or as a reproducible stage of the software pipeline?

    Once context becomes an artifact, it can be reviewed, compared, versioned and validated like other engineering outputs.

    That does not eliminate risk: secret detection is never perfect and token estimates do not replace the target model's tokenizer. The improvement is making those limitations explicit instead of hiding them in a manual step.

    Design criterion

    Should an agent receive as much context as possible, or the smallest context whose origin and selection we can explain?

    Sources and supporting references

    These are some of the works, studies and institutions used as conceptual support for the article's arguments.

    Keep the conversation going

    Want to take this conversation into a real project?

    If this reflection touches something relevant to your current moment, I can help turn context, vision and needs into a well-shaped project.

    More writing from the blog to expand the conversation between technology, process, market and real experience.