Files
AgapHost/ai/hindsight-openclaw-plugin/openclaw.plugin.json
alvis 9094d71e2f ai: migrate LLM backbone from Kimi CLI to Codex CLI
Retires the Moonshot/Kimi subscription in favour of the already-paid ChatGPT
plan. Both CLI wrappers now run `codex exec`; the kimi-agent container is gone.

adolf-llm + hindsight-llm:
- runKimi -> runCodex (`codex exec --json --skip-git-repo-check`), resume via
  `codex exec resume <thread_id>`.
- MCP moves from a per-session .mcp.json (a workaround for Kimi having no
  --mcp-config-file flag) to a $CODEX_HOME/config.toml generated once at
  startup from shared-mcp.json. Field translation is load-bearing:
  bearerTokenEnvVar -> bearer_token_env_var, enabledTools -> enabled_tools.
- approval_policy="never" + sandbox_mode required, or unattended turns block
  on an approval prompt nobody can answer.

kimi-agent removed. It was the ONLY large-tier deployment behind LiteLLM, so
deleting it outright would have silently degraded every large-tier request to
the local 4B model via the existing fallbacks. tier-large, the auto_router
complex-reasoning route and their fallbacks now point at the codex-backed
adolf-llm wrapper (model_name: codex-agent).

Three environment blockers fixed along the way:
- OpenAI geo-blocks this host (403 unsupported_country_region_territory).
  Both containers now egress via the host xray proxy, with NO_PROXY keeping
  MCP and *.alogins.net traffic off the tunnel.
- node:22-slim ships no system CA store; the Rust codex binary validates TLS
  against it, so every HTTPS call failed with a generic transport error while
  Node's own fetch worked. ca-certificates added to both images.
- `codex exec resume` rejects -C/--cd (plain `codex exec` accepts it), which
  broke follow-up turns while first turns succeeded.

Known regression: Kimi's managed-usage API has no Codex equivalent, so the
/usage route returns 501 and there is no quota probe for the codex model.
The two quota plugins degrade quietly to no output.

Also: stop tracking cognee.env (live LLM + JWT secrets) and gitignore it.
The secrets remain in earlier history and should be rotated.

Verified live: plain turn, SSE streaming, session resume, MCP tool call,
bearer-token MCP call, and completions through both LiteLLM routes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014Y5QPagv4iun1ghpwM96Ff
2026-08-01 06:13:27 +00:00

95 lines
4.9 KiB
JSON

{
"id": "hindsight-memory",
"name": "Hindsight Memory",
"description": "Cross-session memory via Hindsight. Injects LLM-free recall context before each reply (before_prompt_build) and retains each turn asynchronously after it ends (agent_end); Hindsight extracts/consolidates server-side, so there is no client-side cognify sweep. Structural successor to cognee-memory (kb #75, H3).",
"activation": {
"onStartup": true
},
"contracts": {
"tools": ["hindsight_recall", "hindsight_reflect"]
},
"configSchema": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": { "type": "boolean" },
"hindsightUrl": { "type": "string" },
"bankId": { "type": "string" },
"humanBanks": { "type": "object", "additionalProperties": { "type": "string" } },
"sharedBankId": { "type": "string" },
"agents": { "type": "array", "items": { "type": "string" } },
"budget": { "type": "string", "enum": ["low", "mid", "high"] },
"recallMaxTokens": { "type": "integer", "minimum": 128, "maximum": 32000 },
"maxContextChars": { "type": "integer", "minimum": 200, "maximum": 20000 },
"recallTimeoutMs": { "type": "integer", "minimum": 500, "maximum": 30000 },
"retainTimeoutMs": { "type": "integer", "minimum": 500, "maximum": 60000 },
"minTextChars": { "type": "integer", "minimum": 1, "maximum": 200 },
"retainMinTurnChars": { "type": "integer", "minimum": 0, "maximum": 2000 },
"types": { "type": "array", "items": { "type": "string" } },
"injectHeader": { "type": "string" }
}
},
"uiHints": {
"enabled": {
"label": "Hindsight Memory",
"help": "Enable cross-session Hindsight memory (recall inject + async turn retain)."
},
"hindsightUrl": {
"label": "Hindsight URL",
"help": "Base URL of the Hindsight REST API (default http://hindsight:8888)."
},
"bankId": {
"label": "Bank ID",
"help": "Legacy single-bank fallback. Used only when humanBanks is empty (per-human partitioning disabled) — recall/retain both target this one bank for every sender, the pre-A2A-21 (kb#153) behavior."
},
"humanBanks": {
"label": "Per-Human Private Banks",
"help": "Map of interlocutor id (Matrix sender, e.g. \"@admin:mtx.alogins.net\") -> that human's private Hindsight bank id (e.g. \"adolf-alvis\"). Non-empty enables per-human memory partitioning (kb#153/A2A-21 DESIGN §5b): recall/retain resolve the bank by the turn's sender instead of a single static bankId. A sender with no entry here is treated as unknown: recall falls back to sharedBankId only (never a guessed private bank) and retain is skipped entirely — this is the hard cross-human-leakage rule, not a gap to silently work around."
},
"sharedBankId": {
"label": "Shared Household Bank",
"help": "Hindsight bank id for facts explicitly shared across all humans (e.g. \"adolf-shared\"). Recalled alongside the sender's private bank when humanBanks is non-empty. Hooks never write here automatically — promotion from a private bank to shared is a human's explicit action/approval task, never an automatic retain (DESIGN §5b hard rule)."
},
"agents": {
"label": "Target Agents",
"help": "Agent ids that use Hindsight memory. Empty means all agents."
},
"budget": {
"label": "Recall/Reflect Budget",
"help": "Effort level for recall and reflect calls (low/mid/high). Higher costs more latency."
},
"recallMaxTokens": {
"label": "Recall Max Tokens",
"help": "Hindsight's own token budget for a single recall call's results."
},
"maxContextChars": {
"label": "Max Injected Context Chars",
"help": "Hard cap on the size of the injected memory block."
},
"recallTimeoutMs": {
"label": "Recall Timeout (ms)",
"help": "Budget for the LLM-free recall on the reply path. On timeout the turn proceeds with no injected memory."
},
"retainTimeoutMs": {
"label": "Retain Timeout (ms)",
"help": "Budget for the post-turn async retain call to Hindsight (off the reply path; async:true itself makes Hindsight's extraction non-blocking, this only bounds the HTTP request)."
},
"minTextChars": {
"label": "Minimum Text Chars",
"help": "Skip recall/retain for text shorter than this."
},
"retainMinTurnChars": {
"label": "Retain Min Turn Chars",
"help": "Skip the post-turn retain (a full 2nd Kimi call) for turns whose combined User/Assistant text is shorter than this — trivial acks carry no durable facts. 0 retains everything (kb#101 token-burn gate; default 48)."
},
"types": {
"label": "Recall Types",
"help": "Fact types to recall: world, experience, observation. Defaults to world and experience."
},
"injectHeader": {
"label": "Inject Header",
"help": "Header line prepended to the injected memory block."
}
}
}