Files
matrix-bridge/scripts/capture-note.sh
T
Keysat 2bae2f3571 Add capture mode: /capture + per-room capture threads → cross-project inbox
A capture-thread message (or /capture <text> in any room) logs to standards/
INBOX.md via capture-note.sh — deterministic, no claude call — and confirms
in-thread; /triage stays the gate into each repo (D13). Thread roots seeded by
seed-capture-threads.py.
2026-06-16 14:59:38 -05:00

46 lines
1.7 KiB
Bash
Executable File

#!/bin/zsh -l
# capture-note.sh — matrix-bridge capture wrapper.
#
# Invoked over SSH by the bot: capture-note.sh <project> <text...>
# Appends ONE line to the cross-project inbox (standards/INBOX.md) in the exact format the
# /capture skill uses, commits it, and best-effort pushes — so /triage (run later inside the
# target repo) drains it like any other captured item.
#
# Deterministic on purpose: no LLM, no token, nothing leaves the Mac except the git push to
# Gitea. The "smarts" (real type/priority, repo-routing, phrasing) stay at /triage, where the
# human is — and routing message text through a frontier model would break the sovereignty
# boundary (D13/D8). Defaults every capture to a raw [idea][P2]; /triage reclassifies.
#
# Why a login shell (-l): git config / PATH live in ~/.zprofile, which a non-login SSH shell
# skips — the same seam as launch-claude.sh / ask-claude.sh.
set -e
standards="$HOME/Projects/standards"
inbox="$standards/INBOX.md"
project="$1"
shift || true
note="$*"
if [[ -z "$project" || -z "$note" ]]; then
print -u2 "usage: capture-note.sh <project> <text>"
exit 2
fi
if [[ ! -f "$inbox" ]]; then
print -u2 "capture-note: inbox not found: $inbox"
exit 1
fi
line="- [ ] ($project) [idea][P2] $note — via matrix, $(date +%F)"
print -r -- "$line" >> "$inbox"
git -C "$standards" add INBOX.md
git -C "$standards" commit -q -m "Capture: ${note[1,60]} (via matrix)" -- INBOX.md
# Push is best-effort — a captured line committed locally is not lost if Gitea is unreachable.
git -C "$standards" push -q 2>/dev/null || print -u2 "capture-note: push skipped/failed (committed locally)"
# Echo the exact line so the bot can post it back into the thread as confirmation.
print -r -- "$line"