create-egregore 0.21.0-runtime-mvp.19 → 0.21.0-runtime-mvp.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // egregore-launcher-version: 0.21.0-runtime-mvp.19
2
+ // egregore-launcher-version: 0.21.0-runtime-mvp.20
3
3
  //
4
4
  // egregore — launch and browse Egregore instances from your terminal.
5
5
  // Installed by create-egregore. Reads ~/.egregore/instances.json.
@@ -35,7 +35,7 @@ const crypto = require("node:crypto");
35
35
  const { spawnSync, spawn } = require("node:child_process");
36
36
  const readline = require("node:readline");
37
37
 
38
- const VERSION = "0.21.0-runtime-mvp.19";
38
+ const VERSION = "0.21.0-runtime-mvp.20";
39
39
  const REGISTRY = path.join(os.homedir(), ".egregore", "instances.json");
40
40
  const DEFAULT_FILE = path.join(os.homedir(), ".egregore", "default");
41
41
  const UPDATE_CACHE_FILE = path.join(os.homedir(), ".egregore", "update-check.json");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-egregore",
3
- "version": "0.21.0-runtime-mvp.19",
3
+ "version": "0.21.0-runtime-mvp.20",
4
4
  "description": "Set up Egregore for your team in one command — installs the egregore launcher and your choice of Claude Code, Codex, or Pi.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -8,8 +8,8 @@
8
8
  # memory files right after a clean search), so this hook enforces it.
9
9
  #
10
10
  # Scope: a retrieval episode. The guard engages only while this session's
11
- # evidence packet is fresh (written within the last EGREGORE_RETRIEVAL_WINDOW_MIN
12
- # minutes, default 15). Outside an episode — editing a decision record, a skill
11
+ # retrieval episode is fresh (a search or open within the last
12
+ # EGREGORE_RETRIEVAL_WINDOW_MIN minutes, default 15). Outside an episode — editing a decision record, a skill
13
13
  # reading memory, ordinary work — memory reads are untouched. Edit and Write
14
14
  # are never the guard's business. Searching memory with grep passes.
15
15
  #
@@ -26,10 +26,14 @@ case "$TOOL" in Bash|Read) ;; *) exit 0 ;; esac
26
26
  # --- Retrieval episode: this session's packet exists and is fresh ---------
27
27
  SESSION=$(cat "$PROJECT_DIR/.egregore-session-id" 2>/dev/null | tr -cd 'A-Za-z0-9_.-')
28
28
  [ -n "$SESSION" ] || exit 0
29
- PACKET="${TMPDIR:-/tmp}/egregore-retrieval-context/$SESSION.context"
30
- [ -f "$PACKET" ] || exit 0
29
+ # The packet itself is consumed by the PostToolUse hook the moment it is
30
+ # attached, so the episode is recorded by a marker that bin/search.sh and the
31
+ # PostToolUse hook both touch. The packet is checked too, for the window
32
+ # between its write and its consumption.
33
+ CTX_DIR="${TMPDIR:-/tmp}/egregore-retrieval-context"
31
34
  WINDOW_MIN="${EGREGORE_RETRIEVAL_WINDOW_MIN:-15}"
32
- [ -n "$(find "$PACKET" -mmin "-$WINDOW_MIN" 2>/dev/null)" ] || exit 0
35
+ _fresh() { [ -f "$1" ] && [ -n "$(find "$1" -mmin "-$WINDOW_MIN" 2>/dev/null)" ]; }
36
+ _fresh "$CTX_DIR/$SESSION.episode" || _fresh "$CTX_DIR/$SESSION.context" || exit 0
33
37
 
34
38
  _block() {
35
39
  printf 'Egregore: memory sources are opened through the private evidence packet, not printed into the transcript.\n' >&2
@@ -39,5 +39,8 @@ jq -Rs '{
39
39
  )
40
40
  }
41
41
  }' "$PACKET"
42
+ # The packet is one-shot, but the retrieval episode is not: leave a marker so
43
+ # memory-read-guard.sh keeps routing raw memory reads through the opener.
44
+ touch "${PACKET%.context}.episode" 2>/dev/null || true
42
45
  rm -f "$PACKET"
43
46
  exit 0
@@ -283,6 +283,10 @@ cmd_query() {
283
283
  }
284
284
  umask 077
285
285
  printf '%s\n' "$out" > "$packet"
286
+ # The PostToolUse hook consumes the packet the moment it attaches it; the
287
+ # episode marker outlives that so the memory-read guard knows a retrieval
288
+ # just happened.
289
+ touch "${packet%.context}.episode" 2>/dev/null || true
286
290
  _banner_and_emit "$label" "$t0" "$emit" "$out" 1
287
291
  else
288
292
  _banner_and_emit "$label" "$t0" "$emit" "$out"
@@ -343,6 +347,7 @@ case "${1:-}" in
343
347
  umask 077
344
348
  if _runtime open "$OPEN_PATH" > "$packet" 2>"$packet.err"; then
345
349
  rm -f "$packet.err"
350
+ touch "${packet%.context}.episode" 2>/dev/null || true
346
351
  echo "↳ opened $OPEN_PATH · content attached privately"
347
352
  else
348
353
  cat "$packet.err" >&2 2>/dev/null
@@ -283,6 +283,10 @@ cmd_query() {
283
283
  }
284
284
  umask 077
285
285
  printf '%s\n' "$out" > "$packet"
286
+ # The PostToolUse hook consumes the packet the moment it attaches it; the
287
+ # episode marker outlives that so the memory-read guard knows a retrieval
288
+ # just happened.
289
+ touch "${packet%.context}.episode" 2>/dev/null || true
286
290
  _banner_and_emit "$label" "$t0" "$emit" "$out" 1
287
291
  else
288
292
  _banner_and_emit "$label" "$t0" "$emit" "$out"
@@ -343,6 +347,7 @@ case "${1:-}" in
343
347
  umask 077
344
348
  if _runtime open "$OPEN_PATH" > "$packet" 2>"$packet.err"; then
345
349
  rm -f "$packet.err"
350
+ touch "${packet%.context}.episode" 2>/dev/null || true
346
351
  echo "↳ opened $OPEN_PATH · content attached privately"
347
352
  else
348
353
  cat "$packet.err" >&2 2>/dev/null
@@ -283,6 +283,10 @@ cmd_query() {
283
283
  }
284
284
  umask 077
285
285
  printf '%s\n' "$out" > "$packet"
286
+ # The PostToolUse hook consumes the packet the moment it attaches it; the
287
+ # episode marker outlives that so the memory-read guard knows a retrieval
288
+ # just happened.
289
+ touch "${packet%.context}.episode" 2>/dev/null || true
286
290
  _banner_and_emit "$label" "$t0" "$emit" "$out" 1
287
291
  else
288
292
  _banner_and_emit "$label" "$t0" "$emit" "$out"
@@ -343,6 +347,7 @@ case "${1:-}" in
343
347
  umask 077
344
348
  if _runtime open "$OPEN_PATH" > "$packet" 2>"$packet.err"; then
345
349
  rm -f "$packet.err"
350
+ touch "${packet%.context}.episode" 2>/dev/null || true
346
351
  echo "↳ opened $OPEN_PATH · content attached privately"
347
352
  else
348
353
  cat "$packet.err" >&2 2>/dev/null
@@ -283,6 +283,10 @@ cmd_query() {
283
283
  }
284
284
  umask 077
285
285
  printf '%s\n' "$out" > "$packet"
286
+ # The PostToolUse hook consumes the packet the moment it attaches it; the
287
+ # episode marker outlives that so the memory-read guard knows a retrieval
288
+ # just happened.
289
+ touch "${packet%.context}.episode" 2>/dev/null || true
286
290
  _banner_and_emit "$label" "$t0" "$emit" "$out" 1
287
291
  else
288
292
  _banner_and_emit "$label" "$t0" "$emit" "$out"
@@ -343,6 +347,7 @@ case "${1:-}" in
343
347
  umask 077
344
348
  if _runtime open "$OPEN_PATH" > "$packet" 2>"$packet.err"; then
345
349
  rm -f "$packet.err"
350
+ touch "${packet%.context}.episode" 2>/dev/null || true
346
351
  echo "↳ opened $OPEN_PATH · content attached privately"
347
352
  else
348
353
  cat "$packet.err" >&2 2>/dev/null