# Text cleaning in your workspace

Text cleaning runs the existing Daedro cleaning MCP locally. Its current Hub operation collapses Unicode whitespace and trims leading/trailing whitespace. It previews transformed text without changing or saving a document. It does not perform semantic correction, model inference, substitution rules or transcription improvement.

## Use the tool

1. Sign in with Google and verify your Google Authenticator code.
2. Open **MCP Marketplace**, select **Available here**, then **Managed text cleaning**.
3. Choose **Use text cleaning**, enter text and select **Preview cleanup**.
4. Read the actual transformed text and input/output byte counts. No credential or additional secret approval is needed because this tool does not access provider secrets.

The account workspace also shows **Open text cleaning** when the worker is installed and its readiness probe succeeded. Missing or failed installations are not advertised as available. Runtime errors report unavailability instead of returning invented output.

## Limits and data handling

- One UTF-8 text field, at most 65,536 bytes. Output is at most 65,536 bytes.
- Fixed `clean_preview` v1 operation: one document, whitespace collapse, no replacements, no deduplication. Clients cannot choose a command, executable path or arbitrary cleaning configuration.
- The combined Text stats and cleaning allowance is 12 requests per account per minute, 60 across the Hub, and two concurrent calls. Profiles do not bypass account quotas. A 429 response includes a retry interval.
- Each invocation starts a fresh local MCP process. Text is sent on stdin and returned only to that request; it is not stored in session state, account history or application logs.
- Browser results clear when navigating away or switching profiles. Copy any result you want to retain yourself. No provider API or paid model is called.
- The process has an eight-second wall-clock deadline, a three-second CPU limit, no file output allowance, bounded file descriptors and bounded JSON-RPC input/output. Linux also applies a 2 GiB address-space ceiling; this is virtual address space, not allocated RAM. The existing service cgroup separately bounds total resident memory.

## API

`POST /api/cleaning` requires the existing authenticated MFA session, exact same-origin request and `X-Daedro-Request: 1`. Send JSON with exactly one field:

```json
{"text":"  First\t document\n"}
```

The result contains `text`, `input_bytes`, `output_bytes` and `changed`. Invalid Unicode, duplicate fields, extra fields and oversize text are rejected. Responses use `Cache-Control: no-store`. Guest access and foreign origins are denied. This endpoint does not expose an object identifier that another account could use to retrieve prior text.

## Operator installation and verified boundary

`make shared-pilot-linux` builds the exact reviewed Go stdio MCP entrypoint in `examples/cleaning/mcp`. The deployment package includes its dependency-free Python source closure. The installer places it under `/opt/daedro-hub/cleaning`, owned by root; the runtime rejects symlinks, nonregular source files, missing files and group/world-writable files or ancestors. The Hub probes the real MCP with synthetic text before publishing availability.

The runner uses a fixed command and sanitized environment. It kills the process group on cancellation. **This is trusted executable isolation per request, not a separate tenant OS sandbox**: the worker runs under the Hub service UID. It cannot safely execute arbitrary uploaded code. The closure must remain reviewed and root-controlled; its lack of persistence does not replace the operating-system boundary needed for custom code hosting.

Verification completed for this slice:

- Existing cleaning package: 15 source tests with the real MCP binary.
- Adapter: actual MCP calls for Unicode, empty and maximum-size text, cancellation, separate successive results, rejected writable installation and no Python cache writes.
- HTTP boundary tests: guest/origin rejection, strict JSON and Unicode, independent account/profile request results and shared quota enforcement.
- Linux deployment probe: two concurrent near-limit synthetic inputs executed as the Hub UID under an enforced 128 MiB cgroup, 100% CPU and no swap. Exact transformed output lengths passed. This demonstrates that bounded probe, not unlimited capacity or a benchmark for arbitrary workloads.

No new infrastructure is required for this operation. On November 5, the combined release was deployed at https://daedro.hub.rokenshi.com. The public readiness API reported cleaning available, its instruction page returned HTTP 200, and an unauthenticated invocation returned HTTP 401. A real user’s Google/MFA browser session was not automated during this deployment check.
