# Bounded text projections (#259)

- Optional machine-local text_projection maps lowercase extensions to argv arrays. Each uses one separate {input} argument. No shell string, automatic converter install or default command.
- Example: { "text_projection": { ".docx": ["/usr/bin/textutil", "-convert", "txt", "-stdout", "{input}"] } }. Configure the converter explicitly for the machine. Shared/tracked config cannot choose these programs.
- Facts excludes private paths before conversion. The converter reads an immutable snapshot in an owned temporary directory, from its own scratch directory, with literal read grants for that file and for the program and script files its argv names (relative ones are passed as absolute paths, and the directories above an in-project script can be listed) (nothing else in the project is readable, even under a `local.read_allow` entry that encloses it, so a converter that follows an include or loads a sibling helper module fails), uses the existing macOS no-network/read-only sandbox and has a 5-second deadline, 16 MiB input cap and 256 KiB stdout/stderr cap. A trusted helper owns and stops its process group; converter stderr is never published.
- Output caches in state by raw content hash, extension and argv/program/script metadata fingerprint. Invalid/oversized cache or failing/unavailable conversion falls back to the existing raw/binary facts behavior, with one bounded notice per extension. A conversion that fails with its full deadline is not tried again for the same bytes and command while its entry lives in the failure record, which is in memory, bounded at 1024 entries, and cleared when full or at restart (#382).
- Raw hashes and git blob identities remain the change identities. Projected text only supplies presentation diffs. A projected read or patch cannot establish raw-file write attribution. Existing text privacy checks and header sanitization still apply.
- A research source registered through a converter binds that extension's current converter fingerprint (argv/program/script metadata and project root) and its full output, at most 256 KiB (#931). After the `text_projection` entry for that extension changes, `hub_evidence_read` reports its evidence links `stale` (`projection_changed`), or `unavailable` once the entry is removed; re-registering the same bytes does not rebind them (docs/profiles.md, "Claim evidence links").
- Converter programs may require temporary writes/caches; those fail under this read-only policy. Use a converter that emits stdout. The owner and other native same-user processes remain outside this boundary.
- Linux retains no-sandbox/no-converter behavior. No native model/account study runs. Shadow repositories and profile override/glob follow-ups remain open in #259.

# Review and undo previews

- A configured projection adds text diffs to review notices and `ahub undo` previews. These are project-snapshot changes, not evidence of authorship or permission to restore raw files.
- Review uses the original task-proposal snapshot, persisted by task id and proposal time. Reviewer replacement and daemon restart retain that baseline. It is never repaired with a later snapshot. Missing or pruned baselines, undeclared paths, disabled snapshots and private snapshot windows are marked unavailable.
- Review includes changed files under declared refs/plan paths and section files only. Private tasks have no review projection. Declared private paths are withheld before conversion; private-data patterns are withheld before publication. Document bodies enter neither task history nor memory through this feature.
- Undo projects the recorded end snapshot back to the recorded start snapshot. It still checks raw files for later edits, concurrent/unknown turns and pruned trees, then repeats its plan immediately before restore. Conversion never writes or authorizes a raw restore.
- Historical blobs must be regular files in the project scope. Symlinks, hub/git metadata and denylisted paths are refused. Deleted and created documents use their stored bytes; no current file read substitutes for a missing old version. Converter identities must agree across a pair.
- A preview shares an 8-second monotonic deadline across git reads, conversion and diffing. Each converter still has at most 5 seconds; termination stops its owned process group. At most 8 files and 12000 UTF-8 bytes of presentation are shown, with explicit omissions. CLI previews strip terminal controls and all inserted headers are quoted.
- Converter failure preserves the ordinary file-only view. Linux continues to refuse conversion without the supported sandbox. Native model consumption and live research-profile/account studies remain unverified.
