{
  "id": "feedback-loop",
  "name": "Proactive Feedback Loop",
  "description": "Logs every proactive send (kb #125) and its outcome — accepted/dismissed/irrelevant/ignored/not_sent — using the DESIGN-proactive-prioritization.md (kb #123) §5 schema. Captures feedback via short text replies (+/-/неактуально) observed on message_received, and via a best-effort peek at Matrix emoji-reaction system-event text on before_prompt_build (no dedicated reaction hook exists in OpenClaw today — see plugin README/report). Exposes log_proactive_action and get_proactive_feedback_stats tools so Adolf (and later kb #123's gate) can record sends and read back Laplace-smoothed per-class acceptance rates. No conversation-content hooks used — no allowConversationAccess/allowPromptInjection opt-in required.",
  "activation": {
    "onStartup": true
  },
  "contracts": {
    "tools": ["log_proactive_action", "get_proactive_feedback_stats"]
  },
  "configSchema": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
      "enabled": { "type": "boolean" },
      "maxRecords": { "type": "integer", "minimum": 50, "maximum": 50000 },
      "ignoreAfterMs": { "type": "integer", "minimum": 60000, "maximum": 2592000000 },
      "replyFallbackWindowMs": { "type": "integer", "minimum": 60000, "maximum": 2592000000 },
      "acceptedTextPatterns": { "type": "array", "items": { "type": "string" } },
      "dismissedTextPatterns": { "type": "array", "items": { "type": "string" } },
      "irrelevantTextPatterns": { "type": "array", "items": { "type": "string" } },
      "acceptedEmoji": { "type": "array", "items": { "type": "string" } },
      "dismissedEmoji": { "type": "array", "items": { "type": "string" } },
      "irrelevantEmoji": { "type": "array", "items": { "type": "string" } },
      "statsTrailingN": { "type": "integer", "minimum": 5, "maximum": 1000 }
    }
  },
  "uiHints": {
    "enabled": {
      "label": "Feedback Loop",
      "help": "Enable proactive-action feedback logging and capture."
    },
    "maxRecords": {
      "label": "Max Log Records",
      "help": "Oldest records are pruned FIFO once the log exceeds this many rows (default 5000 — homelab scale, not a hard requirement)."
    },
    "ignoreAfterMs": {
      "label": "Ignore-After (ms)",
      "help": "A sent proactive action with no response by this age is settled to outcome=ignored (weaker negative signal than an explicit dismiss). Default 24h."
    },
    "replyFallbackWindowMs": {
      "label": "Reply Fallback Window (ms)",
      "help": "When an inbound feedback reply does not quote a specific message (no replyToId), fall back to the sender's single newest pending record within this window. If more than one pending record exists, the reply is left unattributed rather than guessed. Default 24h."
    },
    "acceptedTextPatterns": {
      "label": "Accepted Text Patterns",
      "help": "Exact (case-insensitive, trimmed) reply texts that mark the correlated proactive action accepted. Default: [\"+\", \"+1\"]."
    },
    "dismissedTextPatterns": {
      "label": "Dismissed Text Patterns",
      "help": "Exact reply texts that mark the correlated action dismissed. Default: [\"-\", \"−\", \"-1\"] (both hyphen-minus and Unicode minus sign)."
    },
    "irrelevantTextPatterns": {
      "label": "Irrelevant Text Patterns",
      "help": "Exact reply texts that mark the correlated action irrelevant. Default: [\"неактуально\", \"не актуально\", \"irrelevant\", \"not relevant\"]."
    },
    "acceptedEmoji": {
      "label": "Accepted Emoji",
      "help": "Reaction emoji mapped to accepted when opportunistically matched from queued system-event text. Default: [\"👍\"]."
    },
    "dismissedEmoji": {
      "label": "Dismissed Emoji",
      "help": "Reaction emoji mapped to dismissed. Default: [\"👎\"]."
    },
    "irrelevantEmoji": {
      "label": "Irrelevant Emoji",
      "help": "Reaction emoji mapped to irrelevant. Default: [\"🤷\"]."
    },
    "statsTrailingN": {
      "label": "Stats Trailing N",
      "help": "get_proactive_feedback_stats computes each class's acceptance rate over at most this many of its most recent settled records (recency-weighted per DESIGN-proactive-prioritization.md §3.3). Default 50."
    }
  }
}
