Skip to content

feat: inject placeholder-preservation prompt for online providers - #11

Merged
Mby159 merged 1 commit into
mainfrom
feat/placeholder-preservation-prompt
Jun 25, 2026
Merged

Mby159 merged 1 commit into
mainfrom
feat/placeholder-preservation-prompt

Conversation

@Mby159

@Mby159 Mby159 commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Summary

Round 2 step 3 of SplitMind privacy routing. After unifying the redaction source of truth (PR #10), remote providers received redacted text containing placeholders like [REDACTED_EMAIL_0] but no instruction to preserve them. Models could translate, drop, reformat, or invent placeholders, breaking local restoration.

This PR injects a placeholder-preservation instruction into the provider system prompt when a subtask carries privacy placeholders.

Changes

  • splitmind/providers/base.py
    • build_placeholder_preservation_instruction(placeholders): builds the instruction from placeholder IDs only; returns empty string when there are none. Only placeholder IDs are used; original values are never included.
    • compose_system_prompt(task_type, system_prompt, placeholders): composes the task system prompt and appends the preservation instruction when placeholders exist.
  • splitmind/core/engine.py
    • _execute_with_online builds the system prompt via provider.compose_system_prompt(...) using subtask.sensitive_info.keys() and passes it to generate_async.
  • tests/test_placeholder_preservation.py (new)

Privacy guarantee tested

The integration test asserts that the system prompt and the sent prompt contain placeholder IDs but never the raw sensitive values.

Validation

python -m compileall -q splitmind
python -m pytest -q tests

Result:

28 passed

Review note: ~/pip/reviews/splitmind-placeholder-preservation-prompt-2026-06-25.md

Not included

  • No restoration validation metadata yet (next step)
  • Real online providers not tested; mock provider only
  • No aggregation/restore logic change
  • No MCP

@Mby159
Mby159 merged commit 7002355 into main Jun 25, 2026
5 checks passed
@Mby159
Mby159 deleted the feat/placeholder-preservation-prompt branch June 25, 2026 10:38
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