cloverleaf-larry/lib
Bryan Johnson af2ffe883c v0.7.1: status line below prompt + automatic PHI detection + session-artifact upload
Feature 1 — Status line BELOW the prompt (was: above).
The dim status line now renders AFTER each completed agent_turn and BEFORE
the next prompt, sitting between turns as a footer to the just-finished
exchange. Shipped Option B from the spec — render_status_line moved to the
tail of the REPL loop, the call before printing the prompt was removed.
Option A (cursor manipulation under an active readline prompt) was rejected
because `read -e` takes exclusive control of the cursor and inserting a
repositioned footer below an active prompt is fragile on MobaXterm / Cygwin
(readline redisplay clobbers manual cursor moves). Visual outcome is
identical to "below the previous prompt cycle", and /status still forces a
re-render mid-conversation if needed.

Feature 2 — Automatic PHI detection.
New auto_detect_phi() runs BEFORE preprocess_phi_markers and tokenizes any
value matching PHI-shaped patterns (email, SSN, phone, DOB, MRN 6-12 digits,
HL7 caret-name, "Last, First", or loose "Title Case Title Case"). Uses the
existing hl7-sanitize.sh tokenize-value pipeline so canonicalization
(sort-unique-lowercase NAME tokens, ISO DOB, digits-only PHONE/SSN,
lowercase EMAIL) collapses different surface forms onto one token across
the session. Skipped: paths, URLs, already-tokenized values, manual @@/{{phi:}}
markers, timestamps (13+ digits or 10 digits starting with '1'), and a
built-in allowlist of common non-PHI two-word phrases ("Home Assistant",
"Mac Studio", etc.).

Modes: confirm (default — prompts Y/n on loose name-like matches once per
session), aggressive (silent always-tokenize), off. Env LARRY_AUTO_PHI;
runtime /auto-phi and /auto-phi-status slash commands. Per-turn override
with "!nophi " prefix. Manual markers always win. New normalize-value
subcommand on hl7-sanitize.sh exposes the canonicalization step so the
per-session memory cache uses canonical keys (so "John Smith" and
"JOHN SMITH" share one confirm decision). EMAIL + PHONE categories added
to normalize_value().

Feature 3 — Session-artifact upload at close.
New upload_session_artifacts() POSTs $LARRY_HOME/log/headers.log,
$LARRY_HOME/sessions/<id>.log.md, and <id>.messages.json to
$LARRY_MEMORY_UPLOAD_URL on session exit. Each request carries
X-Larry-Source (headers-log | session-log | session-messages),
X-Larry-Version, and X-Session-Id headers so the ingest side can route
appropriately. Fires from both the clean main_loop exit and the EXIT/INT/TERM
trap (idempotent via _LARRY_UPLOAD_FIRED guard). Unset URL = silent skip
with a one-line warn. Auth tokens are never logged: headers.log captures
only response headers matching ^anthropic-* or ^retry-after: (per v0.6.9
writer); the session log + messages contain post-tokenization content only.

No regressions to v0.7.0 work — HL7 tab completion, mouse mode toggles,
TOOLS_JSON heredoc, streaming, @file refs, status-line existence, slash
completion, and all v0.6.x machinery remain untouched. MANIFEST unchanged.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-27 16:59:01 -07:00
..
csv-to-table.sh v0.4.1: each / each-site / len2nl / csv-to-table / table-to-csv 2026-05-26 11:05:19 -07:00
each-site.sh v0.4.1: each / each-site / len2nl / csv-to-table / table-to-csv 2026-05-26 11:05:19 -07:00
each.sh v0.4.1: each / each-site / len2nl / csv-to-table / table-to-csv 2026-05-26 11:05:19 -07:00
hl7-desanitize.sh v0.3.3: PHI sanitize/desanitize + {{phi:...}} prompt preprocessing 2026-05-26 10:29:20 -07:00
hl7-diff.sh v0.3.0: initial release of Larry-Anywhere 2026-05-26 09:46:20 -07:00
hl7-field.sh v0.3.4: field-name aliases, dot/dash syntax, ops (=, !=, ~, !~), new formats 2026-05-26 10:35:46 -07:00
hl7-sanitize.sh v0.7.1: status line below prompt + automatic PHI detection + session-artifact upload 2026-05-27 16:59:01 -07:00
hl7-schema.sh v0.7.0: HL7-aware tab completion + REPL mouse mode 2026-05-27 16:15:11 -07:00
journal.sh v0.3.0: initial release of Larry-Anywhere 2026-05-26 09:46:20 -07:00
len2nl.sh v0.4.1: each / each-site / len2nl / csv-to-table / table-to-csv 2026-05-26 11:05:19 -07:00
lessons.sh v0.3.2: lesson capture (local-first learning loop) 2026-05-26 10:00:37 -07:00
nc-create-thread.sh v0.4.2: operational layer — engine ctrl, tables CRUD, xlate viz, smat-diff, create-thread, tclgen 2026-05-26 11:11:30 -07:00
nc-diff-interface.sh v0.3.0: initial release of Larry-Anywhere 2026-05-26 09:46:20 -07:00
nc-document.sh v0.3.0: initial release of Larry-Anywhere 2026-05-26 09:46:20 -07:00
nc-engine.sh v0.4.2: operational layer — engine ctrl, tables CRUD, xlate viz, smat-diff, create-thread, tclgen 2026-05-26 11:11:30 -07:00
nc-find.sh v0.3.0: initial release of Larry-Anywhere 2026-05-26 09:46:20 -07:00
nc-inbound.sh v0.3.0: initial release of Larry-Anywhere 2026-05-26 09:46:20 -07:00
nc-insert-protocol.sh v0.3.0: initial release of Larry-Anywhere 2026-05-26 09:46:20 -07:00
nc-make-jump.sh v0.3.0: initial release of Larry-Anywhere 2026-05-26 09:46:20 -07:00
nc-msgs.sh v0.4.0: chain walk, OR/NOT filter groups, numeric/range ops, smat history 2026-05-26 10:58:16 -07:00
nc-parse.sh v0.4.0: chain walk, OR/NOT filter groups, numeric/range ops, smat history 2026-05-26 10:58:16 -07:00
nc-regression.sh v0.6.8: cross-env Cloverleaf workflows over SSH ControlMaster 2026-05-27 15:52:58 -07:00
nc-smat-diff.sh v0.4.2: operational layer — engine ctrl, tables CRUD, xlate viz, smat-diff, create-thread, tclgen 2026-05-26 11:11:30 -07:00
nc-status.sh v0.4.2: operational layer — engine ctrl, tables CRUD, xlate viz, smat-diff, create-thread, tclgen 2026-05-26 11:11:30 -07:00
nc-table.sh v0.4.2: operational layer — engine ctrl, tables CRUD, xlate viz, smat-diff, create-thread, tclgen 2026-05-26 11:11:30 -07:00
nc-tclgen.sh v0.4.2: operational layer — engine ctrl, tables CRUD, xlate viz, smat-diff, create-thread, tclgen 2026-05-26 11:11:30 -07:00
nc-xlate.sh v0.4.2: operational layer — engine ctrl, tables CRUD, xlate viz, smat-diff, create-thread, tclgen 2026-05-26 11:11:30 -07:00
oauth.sh v0.6.6: strip CR from jq output + 0600 oauth file + TAB slash completion 2026-05-27 15:18:51 -07:00
ssh-helper.sh v0.6.8: cross-env Cloverleaf workflows over SSH ControlMaster 2026-05-27 15:52:58 -07:00
table-to-csv.sh v0.4.1: each / each-site / len2nl / csv-to-table / table-to-csv 2026-05-26 11:05:19 -07:00