wayfind 2.0.10 → 2.0.13

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.
package/bin/slack-bot.js CHANGED
@@ -536,6 +536,25 @@ async function searchDecisionTrail(query, config) {
536
536
  results = contentStore.searchText(searchQuery, searchOpts);
537
537
  }
538
538
 
539
+ // If text search returned results but none are journal entries (all signals/conversations),
540
+ // and we have date filters, also try metadata browse to find actual journal entries.
541
+ // This handles broad queries like "today's activity" where keyword search matches
542
+ // signal files but misses the journal entries the user actually wants.
543
+ if (results && results.length > 0 && (dateFilters.since || dateFilters.until)) {
544
+ const hasJournalResults = results.some(r => {
545
+ const source = r.entry?.source;
546
+ return !source || source === 'journal';
547
+ });
548
+ if (!hasJournalResults) {
549
+ const browseOpts = { ...searchOpts };
550
+ const metadataResults = contentStore.queryMetadata(browseOpts);
551
+ if (metadataResults.length > 0) {
552
+ // Prefer metadata browse (actual journal entries) over signal-only text search
553
+ results = metadataResults.slice(0, searchOpts.limit).map(r => ({ ...r, score: 1 }));
554
+ }
555
+ }
556
+ }
557
+
539
558
  // If date-filtered search returned empty, try browsing by date
540
559
  if ((!results || results.length === 0) && (dateFilters.since || dateFilters.until)) {
541
560
  const browseOpts = { ...searchOpts };
@@ -1257,6 +1276,9 @@ async function start(config) {
1257
1276
  if (event.user === botUserId || event.bot_id) return;
1258
1277
  // Ignore messages that mention the bot (handled by app_mention)
1259
1278
  if (event.text && event.text.includes(`<@${botUserId}>`)) return;
1279
+ // Ignore messages that @mention other users — the message is directed at a person, not the bot.
1280
+ // Slack encodes mentions as <@U...>. If any mention is present and none is the bot, skip.
1281
+ if (event.text && /<@U[A-Z0-9]+>/.test(event.text)) return;
1260
1282
  // Ignore message subtypes (edits, joins, etc.)
1261
1283
  if (event.subtype) return;
1262
1284
 
@@ -1311,8 +1311,9 @@ async function runIndexConversationsWithExport(args, detectShifts = false) {
1311
1311
  }
1312
1312
  }
1313
1313
 
1314
- // Context shift detection — single classification per reindex run
1315
- if (detectShifts && stats.pendingExports && stats.pendingExports.length > 0) {
1314
+ // Context shift detection — single classification per reindex run.
1315
+ // Skip entirely when no new decisions were extracted (saves an LLM call).
1316
+ if (detectShifts && stats.decisionsExtracted > 0 && stats.pendingExports && stats.pendingExports.length > 0) {
1316
1317
  console.log('');
1317
1318
  console.log('=== Context Shift Detection ===');
1318
1319
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wayfind",
3
- "version": "2.0.10",
3
+ "version": "2.0.13",
4
4
  "description": "Team decision trail for AI-assisted development. The connective tissue between product, engineering, and strategy.",
5
5
  "bin": {
6
6
  "wayfind": "./bin/team-context.js"
@@ -3,6 +3,8 @@
3
3
  # Runs incremental conversation indexing with journal export after each session.
4
4
  # Extracted decisions get written to the journal directory so they sync via git
5
5
  # and the container's journal indexer picks them up.
6
+ #
7
+ # Performance target: <5s for the common case (no new conversations to process).
6
8
 
7
9
  set -euo pipefail
8
10
 
@@ -24,6 +26,20 @@ if [ -z "$WAYFIND" ]; then
24
26
  fi
25
27
  fi
26
28
 
29
+ # ── Fast path: skip reindex if no conversation files changed ──────────────────
30
+ # The full reindex pipeline (load store, scan transcripts, hash check, LLM calls)
31
+ # has a ~2-3s baseline cost even when nothing changed. This filesystem check
32
+ # short-circuits in <50ms for the common case.
33
+ LAST_RUN_FILE="$HOME/.claude/team-context/.last-reindex"
34
+ if [ -f "$LAST_RUN_FILE" ]; then
35
+ CHANGED=$(find "$HOME/.claude/projects" -name "*.jsonl" -newer "$LAST_RUN_FILE" 2>/dev/null | head -1)
36
+ if [ -z "$CHANGED" ]; then
37
+ # No conversation files changed — skip expensive reindex, just sync journals
38
+ $WAYFIND journal sync 2>/dev/null &
39
+ exit 0
40
+ fi
41
+ fi
42
+
27
43
  # Run incremental reindex (conversations only — journals are handled by the journal write itself)
28
44
  # --conversations-only: skip journals (just written by the session, no need to re-index)
29
45
  # --export: write extracted decisions as journal entries for git sync
@@ -31,6 +47,10 @@ fi
31
47
  # --write-stats: write session stats JSON for status line display
32
48
  $WAYFIND reindex --conversations-only --export --detect-shifts --write-stats 2>/dev/null || true
33
49
 
34
- # Sync authored journals to team-context repo (commit + push)
35
- # This makes local journals available to the container and other team members
36
- $WAYFIND journal sync 2>/dev/null || true
50
+ # Update the marker so the next session's fast-path check works
51
+ mkdir -p "$HOME/.claude/team-context"
52
+ touch "$LAST_RUN_FILE"
53
+
54
+ # Sync authored journals to team-context repo (commit + push) — backgrounded
55
+ # so the session can exit immediately. Git push is the slowest part (~1-3s).
56
+ $WAYFIND journal sync 2>/dev/null &