Enum Class ContextFileSource

java.lang.Object
java.lang.Enum<ContextFileSource>
com.tnsai.quality.security.llm.ContextFileSource
All Implemented Interfaces:
Serializable, Comparable<ContextFileSource>, Constable

public enum ContextFileSource extends Enum<ContextFileSource>
Tag identifying which kind of project-context file a scan operated on. Used by PromptInjectionDetector.detectInProjectContext(String, ContextFileSource) for audit-log attribution and per-source policy decisions.

The framework's project-context loader walks up from the working directory looking for any of these files and feeds their contents into the agent's system prompt. A repo containing an adversarial context file is therefore a clean prompt-injection vector — every agent spun up in that directory ingests the malicious bytes automatically.

Detection scoping considerations:

  • TNSAI_MD / CLAUDE_MD / AGENTS_MD are known agent-instruction surfaces — strict scanning, fail closed on any high-confidence hit.
  • README_MD is auto-loaded by some adapters — the rendered view is what the user sees, so hidden-instruction scans are especially relevant here.
  • OTHER catches custom file conventions; the calling loader still wants the same scan but the audit log gets a useful tag.
Since:
0.8.4
  • Enum Constant Details

    • TNSAI_MD

      public static final ContextFileSource TNSAI_MD
      .tnsai.md — TnsAI's own project-context convention.
    • CLAUDE_MD

      public static final ContextFileSource CLAUDE_MD
      CLAUDE.md — Anthropic Claude Code project-context convention.
    • AGENTS_MD

      public static final ContextFileSource AGENTS_MD
      AGENTS.md / .agents.md — generic agent-instruction file.
    • README_MD

      public static final ContextFileSource README_MD
      README.md — repo-level documentation, sometimes auto-ingested.
    • OTHER

      public static final ContextFileSource OTHER
      Any other project-scoped file passed through the loader.
  • Method Details

    • values

      public static ContextFileSource[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ContextFileSource valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null