john-slop/assets/heuristics.toml

185 lines
4.9 KiB
TOML

# Embedded detection-rule metadata. Milestone 3 compiles and executes these
# matchers; Milestone 2 makes their configuration typed, layered, and validated.
schema_version = 1
[thresholds]
low = 20
medium = 50
high = 75
[[rules]]
id = "assistant-self-identification"
category = "prompt-leakage"
severity = "warning"
matcher = "exact-phrase"
pattern = "As an AI language model"
weight = 30.0
message = "assistant self-identification appears in the source"
help = "Review whether an assistant response was copied into the document."
occurrence_cap = 1
enabled = true
[rules.scope]
content = ["prose"]
extensions = ["md", "txt", "rst", "adoc"]
[[rules]]
id = "knowledge-cutoff-disclaimer"
category = "prompt-leakage"
severity = "warning"
matcher = "exact-phrase"
pattern = "knowledge cutoff"
weight = 20.0
message = "a knowledge-cutoff disclaimer appears in the source"
help = "Verify the statement and remove assistant boilerplate if it is not relevant."
occurrence_cap = 1
enabled = true
[rules.scope]
content = ["prose"]
extensions = ["md", "txt", "rst", "adoc"]
[[rules]]
id = "assistant-capability-disclaimer"
category = "prompt-leakage"
severity = "warning"
matcher = "exact-phrase"
pattern = "I cannot browse the internet"
weight = 20.0
message = "an assistant capability disclaimer appears in the source"
help = "Replace generic capability boilerplate with a source-specific limitation if needed."
occurrence_cap = 1
enabled = true
[rules.scope]
content = ["prose"]
extensions = ["md", "txt", "rst", "adoc"]
[[rules]]
id = "assistant-answer-preface"
category = "prompt-leakage"
severity = "warning"
matcher = "exact-phrase"
pattern = "Certainly! Here's"
weight = 15.0
message = "a stock assistant answer preface appears in the source"
help = "Review whether conversational response scaffolding was copied into the document."
occurrence_cap = 1
enabled = true
[rules.scope]
content = ["prose"]
extensions = ["md", "txt", "rst", "adoc"]
[[rules]]
id = "prompt-response-scaffolding"
category = "prompt-leakage"
severity = "warning"
matcher = "regex"
pattern = "(?m)^(User|Assistant):[ \\t]"
weight = 25.0
message = "prompt/response scaffolding appears in the source"
help = "Confirm that chat transcript markers are intentional."
occurrence_cap = 2
enabled = true
[rules.scope]
content = ["prose", "source-code"]
extensions = []
[[rules]]
id = "templated-conclusion"
category = "style"
severity = "advice"
matcher = "regex"
pattern = "(?i)\\bin conclusion,? (it is|we can)"
weight = 5.0
message = "a templated conclusion phrase appears in the source"
help = "Review whether the conclusion adds specific information."
occurrence_cap = 2
enabled = true
[rules.scope]
content = ["prose"]
extensions = ["md", "txt", "rst", "adoc"]
[[rules]]
id = "templated-filler"
category = "style"
severity = "advice"
matcher = "regex"
pattern = "(?i)\\bit is (?:important|worth) (?:to note|noting) that\\b"
weight = 4.0
message = "a generic filler transition appears in the source"
help = "Prefer a direct, source-specific statement when the transition adds no meaning."
occurrence_cap = 1
enabled = true
[rules.scope]
content = ["prose"]
extensions = ["md", "txt", "rst", "adoc"]
[[rules]]
id = "repeated-transition"
category = "style"
severity = "advice"
matcher = "repeated-regex"
pattern = "(?im)^(?:Moreover|Furthermore|Additionally),[ \\t]"
weight = 4.0
message = "the same family of stock transitions is repeated"
help = "Review repeated transitions and keep only those that clarify the argument."
occurrence_cap = 3
enabled = true
[rules.scope]
content = ["prose"]
extensions = ["md", "txt", "rst", "adoc"]
[[rules]]
id = "source-placeholder-todo"
category = "source-code"
severity = "warning"
matcher = "regex"
pattern = "(?i)\\bTODO:[ \\t]+(implement|add implementation)\\b"
weight = 10.0
message = "an implementation placeholder remains in source code"
help = "Implement the missing behavior or link the placeholder to tracked work."
occurrence_cap = 3
enabled = true
[rules.scope]
content = ["source-code"]
extensions = ["c", "cpp", "go", "java", "js", "py", "rs", "ts"]
[[rules]]
id = "source-tutorial-narration"
category = "source-code"
severity = "advice"
matcher = "regex"
pattern = "(?im)^[ \\t]*//[ \\t]*(?:first|next|finally),?[ \\t]+we\\b"
weight = 8.0
message = "a tutorial-style narration comment appears in source code"
help = "Describe why the code exists rather than narrating the next obvious operation."
occurrence_cap = 2
enabled = true
[rules.scope]
content = ["source-code"]
extensions = ["c", "cpp", "go", "java", "js", "rs", "ts"]
[[rules]]
id = "typography-non-ascii-hyphen"
category = "typography"
severity = "advice"
matcher = "replacement"
pattern = "configured-replacements"
weight = 10.0
message = "a configured non-ASCII character has an ASCII replacement"
help = "Review the punctuation or apply the configured safe replacement."
occurrence_cap = 5
enabled = true
[rules.scope]
content = ["prose", "source-code"]
extensions = []