Skip to content

feat(classifier): harness risk classifier (split from #181) - #189

Open
raymondginger2018-sudo wants to merge 2 commits into
HKUDS:mainfrom
raymondginger2018-sudo:pr181/classifier
Open

feat(classifier): harness risk classifier (split from #181)#189
raymondginger2018-sudo wants to merge 2 commits into
HKUDS:mainfrom
raymondginger2018-sudo:pr181/classifier

Conversation

@raymondginger2018-sudo

Copy link
Copy Markdown
Contributor

Summary

Splits the risk-classifier module out of #181 (maintainer suggestion). New files only — no existing behavior modified while DEEPCODE_RISK_CLASSIFIER is unset.

core/harness/classifier.py is a prompt-injection defense: a fast rule-based scorer (keyword + boundary heuristics) that flags suspicious user/harness content before it reaches the loop, with a classify(text) -> RiskDecision API and an allowlist for expected patterns. Gated behind DEEPCODE_RISK_CLASSIFIER so behavior is opt-in.

Tests

tests/test_harness_classifier.py — 14 passed locally.

@raymondginger2018-sudo

Copy link
Copy Markdown
Contributor Author

@Zongwei9888 Per your 08-17 suggestion on #181, this is the risk classifier module split out as an independent PR: new files only (core/harness/classifier.py + tests/test_harness_classifier.py, 14 tests), opt-in behind DEEPCODE_RISK_CLASSIFIER, merge-order independent of the sibling splits (#188 keyring, #190 wiring).

CI status: Python CI / Desktop CI / Linting green; the Security CI failure is the repo-wide pip advisory (PYSEC-2026-3721 on the locked pip==26.1.2), fixed in #191 — unrelated to this change.

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.
@raymondginger2018-sudo

Copy link
Copy Markdown
Contributor Author

Hi Zongwei, this is the classifier module split from #181. Pure new files, 14 tests, no behavior changes to existing code. Rebased onto latest main (e0767d0), all 14 CI checks green. Merge-order independent. Ready for review when you have a moment. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant