Expand description
Trace export (Task 12): metadata export of persisted
synaps-request-trace/1 records, explicit redacted content export, and
the recursive secret redaction they share.
- Metadata export (
synaps trace export <id> --metadata-only): reads the private trace JSONL, validates every line as aRequestTrace, selects the records whoseturn_idorrequest_idequals the given (validated, bounded)TraceId, and writes them to a user-selected private file (0600, parent0700), refusing symlinks and pre-existing targets. No network, no content — the records are structurally metadata-only. - Content export (
--include-content --allow-content-export): fail-closed. It requires BOTH flags in the same invocation and an existing ephemeral capture bundle produced by/trace next content(seetrace::controls). The bundle is re-redacted (defense in depth), written under its own clearly-labeled schema (synaps-trace-content-export/1, neversynaps-request-trace/1), and the capture bundle is deleted (consumed). Expired bundles are deleted and refused.
Structs§
- Content
Export - On-disk shape of the content export artifact. NOT a request trace.
- Metadata
Export Stats - Result of a metadata export.
Enums§
- Export
Error - Typed export failure. Every variant is metadata-only (paths, counts).
Constants§
- CONTENT_
EXPORT_ SCHEMA - Schema tag of the content-export artifact. Deliberately distinct from both the request-trace and capture schemas.
Functions§
- export_
content - Export the ephemeral capture bundle for
idinto a fresh private file. Fail-closed: requiresallow_content_export, an existing unexpired bundle, and re-redacts before writing. Consumes (deletes) the bundle. - export_
metadata - Export all records whose
turn_idorrequest_idequalsidfrom the trace JSONL attrace_loginto a fresh private file atoutput. - redact_
command_ text - AGGRESSIVE scrub for one-off display of a command the user is about to
approve (the Confirm prompt preview and the confirmer’s message). It
trades false positives for recall, so it must NOT be used for stored
text the model or user later reads back (context archive, memory,
traces): those use
redact_value/redact_textonly. On top ofredact_textit adds: - redact_
text - Free-text scrub through the shared, high-precision rules
([
scrub_secret_patterns] plus the word-level known-prefix scrub). Returns the input unchanged when clean. - redact_
value - Recursively redact credential-bearing keys and obvious secret-shaped values in place. Returns the number of redactions applied. Applies to nested objects and arrays at any depth.
- sweep_
expired_ captures - Delete any expired capture bundles in
dir(bounded retention sweep).