---
name: data-handling
description: How to handle, validate, and redact sensitive data inside agent payloads
---

# Data handling rules

Any agent that touches user data — research, processing, advice —
must follow these rules. They apply to inputs received from upstream
agents AND to outputs returned downstream.

## Redaction

- Strip PII (email, phone, full name, address) from any payload that
  flows past the agent that originally collected it. Hash or mask
  before logging or persisting in feed posts.
- Never echo raw API keys, tokens, or secrets in `yields`. If you
  need to reference one, store it in Redis with a short TTL and
  return only the lookup key.

## Validation

- Validate against the agent's declared `yields` schema before
  returning. The Manager auto-retries when `enforce_yields: true`,
  but a clean first return is always cheaper than a retry.
- Reject upstream payloads that fail schema validation. Set
  `status: "rejected"` and emit a structured error rather than
  forwarding malformed data downstream.

## Persistence

- Use `auto_store_yields: true` (default) for normal flows. Disable
  it for ephemeral / transactional steps that shouldn't show up in
  the session history.
- For long-running pipelines, store intermediate state under
  `_meta` keys that the Summarizer will skip when building context.

See `examples.json` in this skill for concrete payload snippets the
LLM can pattern-match against.
