john-slop/assets/heuristics.toml

99 lines
2.6 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"
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"
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 = "prompt-response-scaffolding"
category = "prompt-leakage"
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"
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 = "source-placeholder-todo"
category = "source-code"
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 = "typography-non-ascii-hyphen"
category = "typography"
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 = []