CI & Build / Python lint (push) Successful in 3s
CI & Build / Plugin hooks (push) Successful in 14s
CI & Build / TypeScript typecheck (push) Successful in 53s
CI & Build / integration (push) Successful in 1m2s
CI & Build / Python tests (push) Failing after 1m26s
CI & Build / Build & push image (push) Skipped
Step 3 of the Scribe -> Grimoire rename. - Plugin `grimoire` in marketplace `grimoire-plugin`, MCP server key `grimoire`, so tools reach a session as mcp__plugin_grimoire_grimoire__*. - hooks/scribe_* -> hooks/grimoire_*, their shell functions and the TMPDIR ledgers with them; SCRIBE_URL / SCRIBE_TOKEN / SCRIBE_HOOK_DIR / SCRIBE_LEDGER_DIRS -> GRIMOIRE_*; the project marker is `.grimoire`. - skills/using-scribe -> using-grimoire, /grimoire:sync, stored processes arrive as grimoire-proc-<slug>; moment_actions names them the same way. - Migration 0124 rewrites stored skill names (rule_moments, rule_moment_judgments, moment_mappings) from scribe:/scribe-proc- to grimoire:/grimoire-proc-, so a rule mounted on a skill keeps firing. - Settings' install commands and MCP-only defaults, the docs and the tests follow. - scripts/check_plugin.py drops the smoke event for a report-check hook that has no file in plugin/hooks. Kept on purpose: the secret-sealing label, and the names that let backups written as Scribe restore and be counted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
52 lines
2.2 KiB
Bash
Executable File
52 lines
2.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Grimoire — release this session's task claims as it ends.
|
|
#
|
|
# A claim records a session's attention, and a session that ends has none left
|
|
# to give. This is the mechanical half of the hand-off: it needs nothing from
|
|
# the model, only the session id the harness reports. The other half — writing
|
|
# down where the work stands — only the model can do, and it is stated as a
|
|
# practice in the skill and the static context, not here.
|
|
#
|
|
# A TIDY-UP, NOT THE GUARANTEE. SessionEnd does not fire on a crash, a killed
|
|
# terminal or a dropped connection, and those are exactly the cases the claim
|
|
# was designed around. The lease is what makes a dead session's claim read as
|
|
# dead; this only keeps the ordinary exit from leaving a claim to run out.
|
|
#
|
|
# NOT ON /clear. A clear ends one conversation and starts the next in the same
|
|
# terminal, and SessionStart(source=clear) pushes back the work this session
|
|
# had claimed. Releasing here would leave that push with nothing to say. The
|
|
# next write moves the claim wherever the work actually continues.
|
|
#
|
|
# EXIT 0 AND SILENT, ALWAYS. Nobody reads a SessionEnd hook's output, and the
|
|
# session is ending whether this succeeds or not.
|
|
set -uo pipefail
|
|
|
|
# shellcheck source=plugin/hooks/grimoire_defs.sh
|
|
. "$(dirname "${BASH_SOURCE[0]}")/grimoire_defs.sh"
|
|
|
|
event=$(cat 2>/dev/null || true)
|
|
[ -n "$event" ] || exit 0
|
|
|
|
event_flat=$(printf '%s' "$event" | grimoire_json_flat)
|
|
session_id=$(grimoire_json_pick "$event_flat" '.session_id')
|
|
[ -n "$session_id" ] || exit 0
|
|
|
|
# The moment arm's per-session files (its tool cache and the acts ledger)
|
|
# describe a session that is over, on any exit — a clear
|
|
# included, since the next conversation is a new session id.
|
|
safe_sid=$(printf '%s' "$session_id" | tr -c 'A-Za-z0-9._-' '_')
|
|
rm -f "${TMPDIR:-/tmp}/grimoire-moment/${safe_sid}".* 2>/dev/null || true
|
|
|
|
reason=$(grimoire_json_pick "$event_flat" '.reason')
|
|
[ "$reason" = "clear" ] && exit 0
|
|
|
|
command -v curl >/dev/null 2>&1 || exit 0
|
|
grimoire_config || exit 0
|
|
|
|
sid_enc=$(printf '%s' "$session_id" | grimoire_urlenc) || exit 0
|
|
curl -fsS --max-time 4 \
|
|
-H "Authorization: Bearer ${token}" \
|
|
"${url%/}/api/plugin/release-session?session_id=${sid_enc}" \
|
|
>/dev/null 2>&1 || true
|
|
exit 0
|