Skip to content

recall-nudge: UserPromptSubmit hook that runs recall when a proper noun appears (Memory-First, mechanized) #65

Open

Description

@shojikumaru

目的 (Why)

Agents answer questions about a proper noun (a repo, service, person, host, project) from conversation memory alone, even when a prior session already recorded the fact. recall exists but is manual, and the Memory-First rule ("search memory before answering when a proper noun appears") lives only as prose in per-agent instruction files, so it is skipped under load.

Origin: the Memory-First §0.6 rule from an earlier private family design (2026-03, applied to 12 OpenClaw agents as prose, never mechanized). context-kit has no UserPromptSubmit hook today; all six pieces sit at PreToolUse / PostToolUse boundaries.

完了条件 (Done when)

  • New hook hooks/recall-nudge.py (+ .sh wrapper) on UserPromptSubmit: detects proper-noun candidates in the prompt (configurable regex set; default covers repo slugs owner/name, #NNN issue refs, CamelCase / ALLCAPS tokens of 3+ chars, katakana runs) and, when at least one is found and recall is on PATH, runs recall --local-only for the top N candidates with a hard timeout.
  • Returns hookSpecificOutput.additionalContext with at most CK_RECALL_NUDGE_MAX_HITS (default 5) hits, each with provenance path, or a one-line "no local hits for: ..." so the agent knows the search ran. Never blocks the prompt; any failure degrades to no output.
  • Opt-in via an examples/settings.json block (not default-on); env knobs CK_RECALL_NUDGE_TIMEOUT_MS (default 1500), CK_RECALL_NUDGE_MAX_TERMS (default 3), CK_RECALL_NUDGE_PATTERNS (override).
  • Tests: detector unit tests (JA/EN samples, false-positive guard for common words), timeout path, recall-missing path, output cap.
  • Docs: docs/recall.md section + README pieces table row; measured latency on the implementer's machine recorded in the PR.
  • テスト / lint green

触るファイル / モジュール予測

  • hooks/recall-nudge.py
  • hooks/recall-nudge.sh
  • tests/test_recall_nudge.py
  • examples/settings.json
  • docs/recall.md
  • README.md (pieces table, 1 row)

想定スコープ

  • やること: detection + bounded recall invocation + context injection, opt-in.
  • やらないこと: changing recall itself; Supermemory / Meili layers (local-only by default to keep latency bounded); auto-writing anything to memory; any host other than Claude Code hooks.

前提条件 (Blocked by)

None. Size: S.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    component:recallThe multi-layer memory search CLIenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions