feat(classifier): harness risk classifier (split from #181) - #189
feat(classifier): harness risk classifier (split from #181)#189raymondginger2018-sudo wants to merge 2 commits into
Conversation
|
@Zongwei9888 Per your 08-17 suggestion on #181, this is the risk classifier module split out as an independent PR: new files only ( CI status: Python CI / Desktop CI / Linting green; the Security CI failure is the repo-wide pip advisory (PYSEC-2026-3721 on the locked Ready for review. |
Prompt-injection defense: DEEPCODE_RISK_CLASSIFIER-gated classifier that scores incoming user/harness content before it reaches the loop. All new files; existing behavior untouched when the knob is off.
55d4e63 to
f6e06a2
Compare
|
Closing as cleanup after #200 — thanks for your patience. For the record: this is a clean new-module PR (no duplicate on upstream/main), but as it stands it has no runtime call site wired in (it is not yet plugged into the permission/approval path), which per the #200 feedback is the shape that will not be accepted on its own. Parking it rather than leaving it stale: the branch stays on my fork, and I can reopen with the call-site wiring once the current narrow PR (#204) lands. Happy to re-scope if you prefer. |
|
Apologies for the late reply. We did not take this for three reasons: the description (a rule-based keyword scorer with an allowlist and Auto-mode-style risk triage is a real product question, but it needs a design discussion first (framing of the classifier prompt, where it sits in the permission engine, integration tests). Happy to have that conversation in an issue before any code. |
Summary
Splits the risk-classifier module out of #181 (maintainer suggestion). New files only — no existing behavior modified while
DEEPCODE_RISK_CLASSIFIERis unset.core/harness/classifier.pyis a prompt-injection defense: a fast rule-based scorer (keyword + boundary heuristics) that flags suspicious user/harness content before it reaches the loop, with aclassify(text) -> RiskDecisionAPI and an allowlist for expected patterns. Gated behindDEEPCODE_RISK_CLASSIFIERso behavior is opt-in.Tests
tests/test_harness_classifier.py— 14 passed locally.