{"id":"6606c01d-300e-4273-afb2-909fe4c2000e","entityType":"agent","slug":"clawhub-yyiilluu-reflexio","name":"Reflexio","canonicalUrl":"https://www.xpersona.co/agent/clawhub-yyiilluu-reflexio","canonicalPath":"/agent/clawhub-yyiilluu-reflexio","generatedAt":"2026-10-12T15:38:49.170Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-12T02:07:26.750Z","emptyReason":null},"description":"Captures user facts and procedural corrections into .reflexio/ so the agent learns across sessions. Use when: (1) user states a preference, fact, config, or...","descriptionLabel":"Source description","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 957 downloads reported by the source. Last updated 10/12/2026.","installCommand":"clawhub skill install s1752wxw7gr3fp8fs91zp3thxn84w528:reflexio","sourceUrl":"https://clawhub.ai/yyiilluu/reflexio","homepage":"https://clawhub.ai/yyiilluu/skills/reflexio","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/yyiilluu/reflexio","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/yyiilluu/skills/reflexio","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":60,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"Reflexio technical dossier on Xpersona with agent coverage, OPENCLEW support, and live trust metadata."},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-12T02:07:26.750Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-12T02:07:26.750Z","emptyReason":null},"stars":null,"forks":null,"downloads":957,"likes":null,"task":null,"library":null,"packageName":null,"latestVersion":"1.0.10","tractionLabel":"957 downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-12T02:07:26.673Z","emptyReason":null},"lastUpdatedAt":"2026-10-12T02:07:26.750Z","lastCrawledAt":"2026-10-12T02:07:26.673Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-13T02:07:26.673Z","lastVerifiedAt":null,"highlights":[{"version":"1.0.10","createdAt":"2026-04-22T07:42:00.084Z","changelog":"**Reflexio v1.0.10 — Major re-architecture: now runs fully local, storing all memory in .reflexio/ using only OpenClaw primitives.** - Replaced previous server-based design and network-dependent hooks with a native, file-backed skill under the new reflexio-embedded name. - Adds agent-initialization logic: probes and, if approved, auto-configures active-memory and .reflexio/ path registration per agent. - Introduces `reflexio_write_profile`, `reflexio_write_playbook`, and `reflexio_search` tools for profile/playbook management and retrieval. - Documents strict signals and capture requirements (triggers, confirmation/patterns, safety, TTL handling). - Removes network hops, external LLM/service dependencies, and credential prompts: all operation is now fully local and transparent. - Expanded documentation for first-use setup, data safety, and degraded mode operation if configuration steps are declined.","fileCount":24,"zipByteSize":43221},{"version":"1.0.9","createdAt":"2026-04-22T06:29:48.380Z","changelog":"**Major update: Reflexio skill now uses a local server backend for LLM-based session extraction, ships with new slash commands, and simplifies config.** - Switched from embedded agent/consolidator model to a hook approach: all capture, extraction, and aggregation routed through a local Reflexio server at 127.0.0.1:8081. - Added new slash commands: `/reflexio-extract` (publish session learnings) and `/reflexio-aggregate` (merge learnings across agents/sessions). - Removed 27 files related to previous OpenClaw embedded integration (manual agent scripts, prompts, and install scripts). - Added concise setup instructions: requires only a local Reflexio backend and CLI, with any LLM provider supported for extraction. - Privacy & credential handling clarified: skill never reads API keys directly; local server performs LLM calls and may forward excerpts to external model providers. - All configuration moved to `~/.reflexio/`; no more OpenClaw-wide install scripts or privileged changes required.","fileCount":10,"zipByteSize":35751},{"version":"1.0.8","createdAt":"2026-04-16T23:16:36.747Z","changelog":"reflexio 1.0.8 - Added SECURITY.md file outlining security policies for the project. - No functional or runtime changes to the skill itself.","fileCount":30,"zipByteSize":52131},{"version":"1.0.7","createdAt":"2026-04-16T22:59:05.996Z","changelog":"**Reflexio Embedded 1.0.7 — First release of the serverless Reflexio skill for Openclaw** - Captures user facts (profiles) and agent corrections (playbooks) into workspace-local `.reflexio/` directories for seamless, cross-session learning. - Runs entirely within Openclaw; no separate Reflexio server, database, or plugin-owned API keys required. - Uses existing Openclaw LLM and embedding provider (if configured) for all extraction and retrieval — supports offline mode with local models. - Auto-enables the `active-memory` plugin, registers a daily consolidation cron job, and restarts the Openclaw gateway during install. - All data is stored locally; the plugin reads/saves only within known Openclaw workspace folders and `.reflexio/`. - Enhanced privacy: no outbound sync, and no new network traffic beyond your existing Openclaw LLM/embedding provider configuration.","fileCount":29,"zipByteSize":46174},{"version":"1.0.6","createdAt":"2026-04-15T22:16:26.647Z","changelog":"Reflexio 1.0.6 Changelog - Added explicit documentation that enabling this skill requires providing an LLM provider API key during setup, even though no credential is referenced in the skill metadata. - Clarified separation between the hook (stateless, no credential or config reads) and the backend server (which requires and uses the LLM provider key for extraction). - Updated First-Use Setup instructions to highlight the interactive prompt for LLM provider selection and credential entry. - Provided detailed explanation of why the skill metadata omits environment variable requirements, with emphasis on backend/server-level dependencies. - Improved privacy and data collection documentation, ensuring the role of the API key and backend responsibilities are clearly stated.","fileCount":10,"zipByteSize":35741},{"version":"1.0.5","createdAt":"2026-04-15T22:02:33.689Z","changelog":"**Summary:** This update clarifies privacy implications and updates the Reflexio hook to use a JavaScript handler. Localhost-only capture is explicitly limited to the hook; the local Reflexio server may forward excerpts to LLM providers depending on configuration. - Updated the core hook from TypeScript (`handler.ts`) to JavaScript (`handler.js`). - Documentation now explains two network hops: local-only for capture, potentially external for LLM-based extraction. - Privacy section clarifies that the local Reflexio server may send conversation excerpts to third-party LLM APIs depending on `~/.reflexio/.env` settings. - Users are advised to configure a local LLM for fully offline operation if needed. - Setup and opt-out instructions updated to reference the new handler file and make privacy boundaries unambiguous.","fileCount":10,"zipByteSize":33584},{"version":"1.0.4","createdAt":"2026-04-15T21:53:33.339Z","changelog":"reflexio 1.0.4 - Clarifies first-use setup: local Reflexio server must be started manually; hook only communicates with `http://127.0.0.1:8081` - Updates setup steps to check server health and launch server if needed - Explicitly documents server start-up in the instructions and outlines user notification requirements - Refines error-handling: skills degrade gracefully if local server is unreachable - Improves language for transparency, privacy, and opt-out instructions","fileCount":10,"zipByteSize":31558},{"version":"1.0.3","createdAt":"2026-04-15T21:40:41.054Z","changelog":"Version 1.0.3 - Changed to localhost-only: all data is now hard-pinned to your machine, stored under ~/.reflexio/, and never sent off-host. - The hook prepends --server-url http://127.0.0.1:8081 to every reflexio CLI call, overriding all environment variables and user configs. - No environment variables or remote servers are supported; configuration is locked down to prevent data from ever leaving your computer. - Privacy documentation updated to clarify that nothing is ever sent externally, and to improve instructions for opt-out and local data wiping.","fileCount":10,"zipByteSize":32324}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s1752wxw7gr3fp8fs91zp3thxn84w528:reflexio","setupComplexity":"low","setupSteps":["Install using `clawhub skill install s1752wxw7gr3fp8fs91zp3thxn84w528:reflexio` in an isolated environment before connecting it to live workloads.","No published capability contract is available yet, so validate auth and request/response behavior manually.","Review the upstream CLAWHUB listing at https://clawhub.ai/yyiilluu/reflexio before using production credentials."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-yyiilluu-reflexio/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-yyiilluu-reflexio/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-yyiilluu-reflexio/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-yyiilluu-reflexio/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-yyiilluu-reflexio/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-yyiilluu-reflexio/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-12T15:38:49.164Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-yyiilluu-reflexio/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-yyiilluu-reflexio/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-yyiilluu-reflexio/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-yyiilluu-reflexio/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-12T02:07:26.750Z","emptyReason":null},"readme":"Skill: Reflexio\n\nOwner: yyiilluu\n\nSummary: Captures user facts and procedural corrections into .reflexio/ so the agent learns across sessions. Use when: (1) user states a preference, fact, config, or...\n\nTags: latest:1.0.10\n\nVersion history:\n\nv1.0.10 | 2026-04-22T07:42:00.084Z | user\n\n**Reflexio v1.0.10 — Major re-architecture: now runs fully local, storing all memory in .reflexio/ using only OpenClaw primitives.**\n\n- Replaced previous server-based design and network-dependent hooks with a native, file-backed skill under the new reflexio-embedded name.\n- Adds agent-initialization logic: probes and, if approved, auto-configures active-memory and .reflexio/ path registration per agent.\n- Introduces `reflexio_write_profile`, `reflexio_write_playbook`, and `reflexio_search` tools for profile/playbook management and retrieval.\n- Documents strict signals and capture requirements (triggers, confirmation/patterns, safety, TTL handling).\n- Removes network hops, external LLM/service dependencies, and credential prompts: all operation is now fully local and transparent.\n- Expanded documentation for first-use setup, data safety, and degraded mode operation if configuration steps are declined.\n\nv1.0.9 | 2026-04-22T06:29:48.380Z | user\n\n**Major update: Reflexio skill now uses a local server backend for LLM-based session extraction, ships with new slash commands, and simplifies config.**\n\n- Switched from embedded agent/consolidator model to a hook approach: all capture, extraction, and aggregation routed through a local Reflexio server at 127.0.0.1:8081.\n- Added new slash commands: `/reflexio-extract` (publish session learnings) and `/reflexio-aggregate` (merge learnings across agents/sessions).\n- Removed 27 files related to previous OpenClaw embedded integration (manual agent scripts, prompts, and install scripts).\n- Added concise setup instructions: requires only a local Reflexio backend and CLI, with any LLM provider supported for extraction.\n- Privacy & credential handling clarified: skill never reads API keys directly; local server performs LLM calls and may forward excerpts to external model providers.\n- All configuration moved to `~/.reflexio/`; no more OpenClaw-wide install scripts or privileged changes required.\n\nv1.0.8 | 2026-04-16T23:16:36.747Z | user\n\nreflexio 1.0.8\n\n- Added SECURITY.md file outlining security policies for the project.\n- No functional or runtime changes to the skill itself.\n\nv1.0.7 | 2026-04-16T22:59:05.996Z | user\n\n**Reflexio Embedded 1.0.7 — First release of the serverless Reflexio skill for Openclaw**\n\n- Captures user facts (profiles) and agent corrections (playbooks) into workspace-local `.reflexio/` directories for seamless, cross-session learning.\n- Runs entirely within Openclaw; no separate Reflexio server, database, or plugin-owned API keys required.\n- Uses existing Openclaw LLM and embedding provider (if configured) for all extraction and retrieval — supports offline mode with local models.\n- Auto-enables the `active-memory` plugin, registers a daily consolidation cron job, and restarts the Openclaw gateway during install.\n- All data is stored locally; the plugin reads/saves only within known Openclaw workspace folders and `.reflexio/`.\n- Enhanced privacy: no outbound sync, and no new network traffic beyond your existing Openclaw LLM/embedding provider configuration.\n\nv1.0.6 | 2026-04-15T22:16:26.647Z | user\n\nReflexio 1.0.6 Changelog\n\n- Added explicit documentation that enabling this skill requires providing an LLM provider API key during setup, even though no credential is referenced in the skill metadata.\n- Clarified separation between the hook (stateless, no credential or config reads) and the backend server (which requires and uses the LLM provider key for extraction).\n- Updated First-Use Setup instructions to highlight the interactive prompt for LLM provider selection and credential entry.\n- Provided detailed explanation of why the skill metadata omits environment variable requirements, with emphasis on backend/server-level dependencies.\n- Improved privacy and data collection documentation, ensuring the role of the API key and backend responsibilities are clearly stated.\n\nv1.0.5 | 2026-04-15T22:02:33.689Z | user\n\n**Summary:** This update clarifies privacy implications and updates the Reflexio hook to use a JavaScript handler. Localhost-only capture is explicitly limited to the hook; the local Reflexio server may forward excerpts to LLM providers depending on configuration.\n\n- Updated the core hook from TypeScript (`handler.ts`) to JavaScript (`handler.js`).\n- Documentation now explains two network hops: local-only for capture, potentially external for LLM-based extraction.\n- Privacy section clarifies that the local Reflexio server may send conversation excerpts to third-party LLM APIs depending on `~/.reflexio/.env` settings.\n- Users are advised to configure a local LLM for fully offline operation if needed.\n- Setup and opt-out instructions updated to reference the new handler file and make privacy boundaries unambiguous.\n\nv1.0.4 | 2026-04-15T21:53:33.339Z | user\n\nreflexio 1.0.4\n\n- Clarifies first-use setup: local Reflexio server must be started manually; hook only communicates with `http://127.0.0.1:8081`\n- Updates setup steps to check server health and launch server if needed\n- Explicitly documents server start-up in the instructions and outlines user notification requirements\n- Refines error-handling: skills degrade gracefully if local server is unreachable\n- Improves language for transparency, privacy, and opt-out instructions\n\nv1.0.3 | 2026-04-15T21:40:41.054Z | user\n\nVersion 1.0.3\n\n- Changed to localhost-only: all data is now hard-pinned to your machine, stored under ~/.reflexio/, and never sent off-host.\n- The hook prepends --server-url http://127.0.0.1:8081 to every reflexio CLI call, overriding all environment variables and user configs.\n- No environment variables or remote servers are supported; configuration is locked down to prevent data from ever leaving your computer.\n- Privacy documentation updated to clarify that nothing is ever sent externally, and to improve instructions for opt-out and local data wiping.\n\nv1.0.2 | 2026-04-15T21:18:08.629Z | user\n\nUse localhost only\n\nv1.0.1 | 2026-04-15T20:59:23.469Z | user\n\nreflexio 1.0.1 Changelog\n\n- Major update: adds extensive privacy and data collection disclosure, clarifying exactly what is captured, where it is sent, and how to disable features.\n- SKILL.md rewritten to prioritize user transparency and consent, including a new \"Privacy & Data Collection\" section at the top.\n- Now instructs agents to announce Reflexio’s activity and destination on session start, and when background servers are launched.\n- Detailed instructions for per-session and permanent opt-outs, as well as search-only configurations.\n- The description clarifies cross-instance learning and how Reflexio aggregates corrections for all OpenClaw agents.\n- Enhanced warnings: explicitly instructs users to audit the Reflexio server destination before enabling the skill.\n\nv1.0.0 | 2026-04-15T20:48:25.998Z | user\n\nInitial release of reflexio skill for OpenClaw:\n\n- Enables agents to search Reflexio for task-specific playbooks and user preferences before starting any task.\n- Publishes corrections, user preferences, and key learnings to Reflexio when users correct, intervene, or a milestone is completed.\n- Installs CLI tools and hooks for seamless integration with OpenClaw, including auto-injection of behavioral rules.\n- Gracefully degrades if Reflexio cannot be installed or reached—never blocks user tasks.\n- Step-by-step instructions for setup, searching, and publishing, including handling of multi-agent and multi-user cases.\n\nArchive index:\n\nArchive v1.0.10: 24 files, 43221 bytes\n\nFiles: _meta.json (128b), agents/reflexio-extractor.md (2009b), HEARTBEAT.md (155b), hook/handler.ts (6874b), hook/setup.ts (2085b), index.ts (13354b), lib/consolidate.ts (8415b), lib/dedup.ts (3538b), lib/io.ts (4097b), lib/openclaw-cli.ts (1868b), lib/search.ts (1017b), lib/write-playbook.ts (2776b), lib/write-profile.ts (2870b), openclaw.plugin.json (1509b), package.json (487b), prompts/full_consolidation.md (1980b), prompts/playbook_extraction.md (14194b), prompts/profile_extraction.md (7836b), prompts/README.md (1141b), README.md (2479b), skill-card.md (2031b), SKILL.md (9555b), skills/reflexio-consolidate/SKILL.md (1451b), skills/reflexio-embedded/SKILL.md (9555b)\n\nFile v1.0.10:SKILL.md\n\n---\nname: reflexio-embedded\ndescription: \"Captures user facts and procedural corrections into .reflexio/ so the agent learns across sessions. Use when: (1) user states a preference, fact, config, or constraint; (2) user corrects the agent and confirms the fix with an explicit 'good'/'perfect' or by moving on without re-correcting for 1-2 turns; (3) at start of a user turn, to retrieve relevant facts and playbooks from past sessions.\"\nmetadata:\n---\n\n# Reflexio Embedded Skill\n\nCaptures user facts (profiles) and procedural corrections (playbooks) into `.reflexio/`, so the agent learns across sessions. All memory lives in Openclaw's native primitives — no external service required.\n\n## First-time setup per agent\n\nIf `.reflexio/.setup_complete_<agentId>` does NOT exist (where `<agentId>` is your current agent id), perform this one-time check. The setup step runs probing commands via `exec` and asks for approval before making changes.\n\n**Steps:**\n\n1. Probe current config:\n   - `openclaw config get plugins.entries.active-memory.config.agents`\n   - `openclaw config get agents.defaults.memorySearch.extraPaths`\n   - `openclaw memory status --deep`\n\n2. If active-memory is not targeting this agent:\n   Ask user: *\"To auto-inject relevant facts into each turn, I can enable active-memory for this agent. OK if I run `openclaw config set plugins.entries.active-memory.config.agents '[\\\"<agentId>\\\"]' --strict-json`?\"*\n   On approval, run the command.\n\n3. If `.reflexio/` is not registered as an extraPath:\n   Ask user: *\"I need to register .reflexio/ as a memory path. OK if I run `openclaw config set agents.defaults.memorySearch.extraPaths '[\\\".reflexio/\\\"]' --strict-json`?\"*\n   On approval, run the command.\n\n4. If no embedding provider is configured (FTS-only mode):\n   Tell user: *\"Vector search requires an embedding API key (OpenAI, Gemini, Voyage, or Mistral). The plugin works without one but retrieval quality drops. Would you like guidance on adding one?\"*\n   If yes, guide them through `openclaw config set` or `openclaw configure`.\n\n5. On each decline, note the degraded mode but do not block:\n   - No active-memory → you must run `openclaw memory search` via exec at turn start (see \"Retrieval\" section below).\n   - No extraPath → WARN the user the plugin cannot function without this step.\n   - No embedding → continue with FTS-only.\n\n6. When all checks resolved (approved or accepted with warning): create the marker:\n   ```bash\n   mkdir -p .reflexio\n   touch .reflexio/.setup_complete_<agentId>\n   ```\n\n**If exec is not available** (strict admin policy): fall back to telling the user the exact commands to run manually.\n\n## First-Use Initialisation\n\nBefore any write, ensure `.reflexio/` and its subdirectories exist. This is idempotent — safe to run every session:\n\n```bash\nmkdir -p .reflexio/profiles .reflexio/playbooks\n```\n\nNever overwrite existing files. Never write secrets, tokens, private keys, environment variables, or credentials into `.reflexio/` files. When capturing a fact involves a user-pasted snippet that contains credentials, redact first.\n\n## Quick Reference\n\n| Situation                                                 | Action                                     |\n|-----------------------------------------------------------|--------------------------------------------|\n| User states preference, fact, config, or constraint       | `reflexio_write_profile` tool              |\n| User correction → you adjust → user confirms              | `reflexio_write_playbook` tool             |\n| Start of user turn, need context                          | `reflexio_search` tool                     |\n| Unsure whether to capture                                 | Skip; batch pass at session-end has a second shot |\n\n## Detection Triggers\n\n### Profile signals (write immediately, same turn)\n\n- **Preferences**: \"I prefer X\", \"I like Y\", \"I don't like Z\", \"I always do Q\"\n- **Facts about self**: \"I'm a [role]\", \"my timezone is X\", \"I've been doing Y for Z years\"\n- **Config**: \"use X\", \"our team uses Y\", \"the repo is at Z\"\n- **Constraints**: \"I'm vegetarian\", \"no dairy\", \"I can't X\", \"don't use Y\"\n\nFor each such signal, call the `reflexio_write_profile` tool with a kebab-case topic slug and an appropriate TTL. See \"TTL Selection\" below.\n\n### Playbook signals (write AFTER confirmation)\n\nPlaybooks require a specific multi-turn pattern:\n\n1. **Correction**: *\"No, that's wrong\"*, *\"Actually...\"*, *\"Don't do X\"*, *\"Not like that\"*, *\"We don't use X here\"*.\n2. **You adjust**: you redo the work per the correction.\n3. **Confirmation** (required — without this, do NOT write a playbook):\n   - Explicit: *\"good\"*, *\"perfect\"*, *\"yes that's right\"*, *\"correct\"*.\n   - Implicit: the user moves to an unrelated topic without re-correcting for 1-2 more turns.\n\n**Explicit don't-write rule**: if you see a correction without subsequent confirmation, do not write a playbook. The fix may be wrong; let the batch pass at session end re-evaluate.\n\n## Retrieval\n\n### When Active Memory is enabled\n\nYour turn context may already contain Reflexio-prefixed entries injected by Active Memory. Incorporate them before responding. No tool call needed.\n\n### Fallback when Active Memory is absent\n\nAt the start of each user turn, call the `reflexio_search` tool with:\n- query: \"<user's message>\"\n\nThe tool handles query preprocessing and memory search internally.\nIncorporate any results into your response. Skip if the user's message is trivial.\n\n**Important:** Do NOT use the `memory_search` tool (returns config, not results)\nor `exec` with `openclaw memory search` — use the `reflexio_search` tool instead.\n\n## File Format\n\n**Do NOT construct filenames or frontmatter by hand.** Use the registered tools (`reflexio_write_profile`, `reflexio_write_playbook`). They generate IDs, enforce the frontmatter schema, and write atomically.\n\n### Profile template (for mental model — the script emits this)\n\n```markdown\n---\ntype: profile\nid: prof_<nanoid>\ncreated: <ISO timestamp>\nttl: <enum>\nexpires: <ISO date or \"never\">\nsupersedes: [<old_id>]   # optional, only after a merge\n---\n\n<1-3 sentences, one fact per file>\n```\n\n### Playbook template\n\n```markdown\n---\ntype: playbook\nid: pbk_<nanoid>\ncreated: <ISO timestamp>\nsupersedes: [<old_id>]   # optional\n---\n\n## When\n<1-sentence trigger — this is the search anchor; make it a noun phrase>\n\n## What\n<2-3 sentences of the procedural rule; DO / DON'T as actually observed>\n\n## Why\n<rationale, can be longer — reference only, not recall content>\n```\n\n### How to invoke\n\n**Profile:** Call the `reflexio_write_profile` tool with:\n- slug: \"diet-vegan\"\n- ttl: \"infinity\"\n- body: \"User is vegan. No meat, no fish, no dairy, no eggs.\"\n\n**Playbook:** Call the `reflexio_write_playbook` tool with:\n- slug: \"commit-no-ai-attribution\"\n- body: \"## When\\nComposing a git commit message.\\n\\n## What\\nNo AI-attribution trailers.\\n\\n## Why\\nUser corrected this.\"\n\n**Retrieve context:** Call the `reflexio_search` tool with:\n- query: \"user's question here\"\n\nAll tools handle preprocessing, memory search, contradiction detection, and file operations internally. You only detect the signal, compose the content, and call the tool.\n\n## TTL Selection (profiles only)\n\n- `infinity` — durable, non-perishable facts (diet, name, permanent preferences)\n- `one_year` — stable but could plausibly change (address, role, team)\n- `one_quarter` — current focus (active project, sprint theme)\n- `one_month` — short-term context\n- `one_week` / `one_day` — transient (today's agenda, this week's priorities)\n\nPick the most generous TTL that still reflects reality. When in doubt, prefer `infinity` — let dedup handle later contradictions via supersession.\n\n## Safety\n\n- **Never write secrets.** No API keys, tokens, access tokens, private keys, environment variables, OAuth secrets, auth headers. If the user's message contains any of these, redact them before writing.\n- **Redact pasted code.** User-pasted snippets often contain credentials. Strip them first.\n- **PII.** Do not capture PII beyond what's operationally useful (name, timezone, role are fine; government IDs, addresses, phone numbers only if explicitly relevant).\n\n## Best Practices\n\n1. **Write immediately** on a clear signal. Don't queue to session-end — that's Flow C's job; you have a different role.\n2. **One fact per profile file.** Multi-fact files are harder to dedupe and easier to contradict.\n3. **Trigger phrase = search anchor.** Write `## When` as a noun phrase describing the situation, not a sentence. Retrieval hits on semantic similarity to this field.\n4. **Skip writing when uncertain.** Flow C has a second pass over the full transcript. It's better to let it handle ambiguous cases.\n5. **Prefer shorter TTL for transient facts.** Don't let \"working on project X\" accumulate as infinity-TTL cruft.\n\n## Opt-in Hook\n\nThis skill works standalone — your in-session Flow A (profile) and Flow B (playbook) writes populate `.reflexio/` without any hook.\n\nThe optional hook (`hook/` directory of this plugin) adds two capabilities:\n\n1. **TTL sweep at session start**: deletes expired profiles before Active Memory runs.\n2. **Session-end batch extraction (Flow C)**: on `session:compact:before`, `command:stop`, or `command:reset`, spawns a `reflexio-extractor` sub-agent that extracts profiles/playbooks from the full transcript and runs shallow pairwise dedup.\n\nSee this plugin's `README.md` for install instructions (runs via `./scripts/install.sh`). If the hook is not installed, Flows A+B still work.\n\nFile v1.0.10:skills/reflexio-consolidate/SKILL.md\n\n---\nname: reflexio-consolidate\ndescription: \"Run a full-sweep consolidation over all .reflexio/ files — TTL sweep + n-way cluster merge. Use when the user asks to 'clean up reflexio', 'consolidate memory', 'deduplicate playbooks', or suspects drift across sessions.\"\n---\n\n# Reflexio Consolidate\n\nUser-invocable via `/skill reflexio-consolidate`. Same workflow that runs automatically via heartbeat (every 24h of active use), but on-demand.\n\n## What it does\n\n1. TTL sweep: delete expired profile files.\n2. For each of profiles and playbooks:\n   - Cluster similar files via `memory_search`.\n   - For clusters of 2+ members, call `llm-task` with `prompts/full_consolidation.md` to decide consolidate (one-fact-per-file) or keep-all.\n   - Apply decisions: write individual fact files, delete originals.\n\n## How to run\n\nCall the `reflexio_run_consolidation` tool. It spawns the consolidator sub-agent and returns a `runId`.\n\nAfter successful consolidation, call the `reflexio_consolidation_mark_done` tool to update the heartbeat timer.\n\n## When to use\n\n- User asks to \"consolidate\", \"clean up reflexio\", \"dedupe memory\"\n- User reports seeing duplicate or contradictory entries in retrieval\n- Heartbeat check returns ALERT (automatic trigger)\n\n## When NOT to use\n\n- Routine maintenance — heartbeat handles this automatically.\n- Immediately after Flow A/B writes — shallow dedup at write time + Flow C at session end cover the fresh-extraction cases.\n\nFile v1.0.10:skills/reflexio-embedded/SKILL.md\n\n---\nname: reflexio-embedded\ndescription: \"Captures user facts and procedural corrections into .reflexio/ so the agent learns across sessions. Use when: (1) user states a preference, fact, config, or constraint; (2) user corrects the agent and confirms the fix with an explicit 'good'/'perfect' or by moving on without re-correcting for 1-2 turns; (3) at start of a user turn, to retrieve relevant facts and playbooks from past sessions.\"\nmetadata:\n---\n\n# Reflexio Embedded Skill\n\nCaptures user facts (profiles) and procedural corrections (playbooks) into `.reflexio/`, so the agent learns across sessions. All memory lives in Openclaw's native primitives — no external service required.\n\n## First-time setup per agent\n\nIf `.reflexio/.setup_complete_<agentId>` does NOT exist (where `<agentId>` is your current agent id), perform this one-time check. The setup step runs probing commands via `exec` and asks for approval before making changes.\n\n**Steps:**\n\n1. Probe current config:\n   - `openclaw config get plugins.entries.active-memory.config.agents`\n   - `openclaw config get agents.defaults.memorySearch.extraPaths`\n   - `openclaw memory status --deep`\n\n2. If active-memory is not targeting this agent:\n   Ask user: *\"To auto-inject relevant facts into each turn, I can enable active-memory for this agent. OK if I run `openclaw config set plugins.entries.active-memory.config.agents '[\\\"<agentId>\\\"]' --strict-json`?\"*\n   On approval, run the command.\n\n3. If `.reflexio/` is not registered as an extraPath:\n   Ask user: *\"I need to register .reflexio/ as a memory path. OK if I run `openclaw config set agents.defaults.memorySearch.extraPaths '[\\\".reflexio/\\\"]' --strict-json`?\"*\n   On approval, run the command.\n\n4. If no embedding provider is configured (FTS-only mode):\n   Tell user: *\"Vector search requires an embedding API key (OpenAI, Gemini, Voyage, or Mistral). The plugin works without one but retrieval quality drops. Would you like guidance on adding one?\"*\n   If yes, guide them through `openclaw config set` or `openclaw configure`.\n\n5. On each decline, note the degraded mode but do not block:\n   - No active-memory → you must run `openclaw memory search` via exec at turn start (see \"Retrieval\" section below).\n   - No extraPath → WARN the user the plugin cannot function without this step.\n   - No embedding → continue with FTS-only.\n\n6. When all checks resolved (approved or accepted with warning): create the marker:\n   ```bash\n   mkdir -p .reflexio\n   touch .reflexio/.setup_complete_<agentId>\n   ```\n\n**If exec is not available** (strict admin policy): fall back to telling the user the exact commands to run manually.\n\n## First-Use Initialisation\n\nBefore any write, ensure `.reflexio/` and its subdirectories exist. This is idempotent — safe to run every session:\n\n```bash\nmkdir -p .reflexio/profiles .reflexio/playbooks\n```\n\nNever overwrite existing files. Never write secrets, tokens, private keys, environment variables, or credentials into `.reflexio/` files. When capturing a fact involves a user-pasted snippet that contains credentials, redact first.\n\n## Quick Reference\n\n| Situation                                                 | Action                                     |\n|-----------------------------------------------------------|--------------------------------------------|\n| User states preference, fact, config, or constraint       | `reflexio_write_profile` tool              |\n| User correction → you adjust → user confirms              | `reflexio_write_playbook` tool             |\n| Start of user turn, need context                          | `reflexio_search` tool                     |\n| Unsure whether to capture                                 | Skip; batch pass at session-end has a second shot |\n\n## Detection Triggers\n\n### Profile signals (write immediately, same turn)\n\n- **Preferences**: \"I prefer X\", \"I like Y\", \"I don't like Z\", \"I always do Q\"\n- **Facts about self**: \"I'm a [role]\", \"my timezone is X\", \"I've been doing Y for Z years\"\n- **Config**: \"use X\", \"our team uses Y\", \"the repo is at Z\"\n- **Constraints**: \"I'm vegetarian\", \"no dairy\", \"I can't X\", \"don't use Y\"\n\nFor each such signal, call the `reflexio_write_profile` tool with a kebab-case topic slug and an appropriate TTL. See \"TTL Selection\" below.\n\n### Playbook signals (write AFTER confirmation)\n\nPlaybooks require a specific multi-turn pattern:\n\n1. **Correction**: *\"No, that's wrong\"*, *\"Actually...\"*, *\"Don't do X\"*, *\"Not like that\"*, *\"We don't use X here\"*.\n2. **You adjust**: you redo the work per the correction.\n3. **Confirmation** (required — without this, do NOT write a playbook):\n   - Explicit: *\"good\"*, *\"perfect\"*, *\"yes that's right\"*, *\"correct\"*.\n   - Implicit: the user moves to an unrelated topic without re-correcting for 1-2 more turns.\n\n**Explicit don't-write rule**: if you see a correction without subsequent confirmation, do not write a playbook. The fix may be wrong; let the batch pass at session end re-evaluate.\n\n## Retrieval\n\n### When Active Memory is enabled\n\nYour turn context may already contain Reflexio-prefixed entries injected by Active Memory. Incorporate them before responding. No tool call needed.\n\n### Fallback when Active Memory is absent\n\nAt the start of each user turn, call the `reflexio_search` tool with:\n- query: \"<user's message>\"\n\nThe tool handles query preprocessing and memory search internally.\nIncorporate any results into your response. Skip if the user's message is trivial.\n\n**Important:** Do NOT use the `memory_search` tool (returns config, not results)\nor `exec` with `openclaw memory search` — use the `reflexio_search` tool instead.\n\n## File Format\n\n**Do NOT construct filenames or frontmatter by hand.** Use the registered tools (`reflexio_write_profile`, `reflexio_write_playbook`). They generate IDs, enforce the frontmatter schema, and write atomically.\n\n### Profile template (for mental model — the script emits this)\n\n```markdown\n---\ntype: profile\nid: prof_<nanoid>\ncreated: <ISO timestamp>\nttl: <enum>\nexpires: <ISO date or \"never\">\nsupersedes: [<old_id>]   # optional, only after a merge\n---\n\n<1-3 sentences, one fact per file>\n```\n\n### Playbook template\n\n```markdown\n---\ntype: playbook\nid: pbk_<nanoid>\ncreated: <ISO timestamp>\nsupersedes: [<old_id>]   # optional\n---\n\n## When\n<1-sentence trigger — this is the search anchor; make it a noun phrase>\n\n## What\n<2-3 sentences of the procedural rule; DO / DON'T as actually observed>\n\n## Why\n<rationale, can be longer — reference only, not recall content>\n```\n\n### How to invoke\n\n**Profile:** Call the `reflexio_write_profile` tool with:\n- slug: \"diet-vegan\"\n- ttl: \"infinity\"\n- body: \"User is vegan. No meat, no fish, no dairy, no eggs.\"\n\n**Playbook:** Call the `reflexio_write_playbook` tool with:\n- slug: \"commit-no-ai-attribution\"\n- body: \"## When\\nComposing a git commit message.\\n\\n## What\\nNo AI-attribution trailers.\\n\\n## Why\\nUser corrected this.\"\n\n**Retrieve context:** Call the `reflexio_search` tool with:\n- query: \"user's question here\"\n\nAll tools handle preprocessing, memory search, contradiction detection, and file operations internally. You only detect the signal, compose the content, and call the tool.\n\n## TTL Selection (profiles only)\n\n- `infinity` — durable, non-perishable facts (diet, name, permanent preferences)\n- `one_year` — stable but could plausibly change (address, role, team)\n- `one_quarter` — current focus (active project, sprint theme)\n- `one_month` — short-term context\n- `one_week` / `one_day` — transient (today's agenda, this week's priorities)\n\nPick the most generous TTL that still reflects reality. When in doubt, prefer `infinity` — let dedup handle later contradictions via supersession.\n\n## Safety\n\n- **Never write secrets.** No API keys, tokens, access tokens, private keys, environment variables, OAuth secrets, auth headers. If the user's message contains any of these, redact them before writing.\n- **Redact pasted code.** User-pasted snippets often contain credentials. Strip them first.\n- **PII.** Do not capture PII beyond what's operationally useful (name, timezone, role are fine; government IDs, addresses, phone numbers only if explicitly relevant).\n\n## Best Practices\n\n1. **Write immediately** on a clear signal. Don't queue to session-end — that's Flow C's job; you have a different role.\n2. **One fact per profile file.** Multi-fact files are harder to dedupe and easier to contradict.\n3. **Trigger phrase = search anchor.** Write `## When` as a noun phrase describing the situation, not a sentence. Retrieval hits on semantic similarity to this field.\n4. **Skip writing when uncertain.** Flow C has a second pass over the full transcript. It's better to let it handle ambiguous cases.\n5. **Prefer shorter TTL for transient facts.** Don't let \"working on project X\" accumulate as infinity-TTL cruft.\n\n## Opt-in Hook\n\nThis skill works standalone — your in-session Flow A (profile) and Flow B (playbook) writes populate `.reflexio/` without any hook.\n\nThe optional hook (`hook/` directory of this plugin) adds two capabilities:\n\n1. **TTL sweep at session start**: deletes expired profiles before Active Memory runs.\n2. **Session-end batch extraction (Flow C)**: on `session:compact:before`, `command:stop`, or `command:reset`, spawns a `reflexio-extractor` sub-agent that extracts profiles/playbooks from the full transcript and runs shallow pairwise dedup.\n\nSee this plugin's `README.md` for install instructions (runs via `./scripts/install.sh`). If the hook is not installed, Flows A+B still work.\n\nFile v1.0.10:prompts/README.md\n\n# Openclaw-Embedded Prompts\n\nLLM prompt templates used by Flow C sub-agents and consolidation.\n\n## Files\n\n- `profile_extraction.md` — extract durable user facts from a transcript\n- `playbook_extraction.md` — extract procedural rules from correction+confirmation patterns\n- `full_consolidation.md` — consolidate a cluster of similar items into individual facts\n\n## Format\n\nEach file is a `.prompt.md` with YAML frontmatter (matches Reflexio's\n`server/prompt/prompt_bank/` convention). Unlike upstream's versioned layout\n(`<name>/v<ver>.prompt.md`), we store prompts flat (`<name>.md`) since the\nplugin ships atomically with one active version at a time.\n\n```yaml\n---\nactive: true\ndescription: \"one-line description\"\nchangelog: \"what changed in this version\"\nvariables:\n  - var1\n  - var2\n---\n\nprompt body, with {var1} and {var2} substitution points\n```\n\n## Upstream sync\n\n`profile_extraction.md` and `playbook_extraction.md` are ports of Reflexio's\nprompt_bank entries. On upstream bumps, review the prompt diff against our\nadapted versions. Porting notes will be maintained in\n`../references/porting-notes.md` (added in a later phase).\n\nFile v1.0.10:README.md\n\n# Reflexio Embedded\n\nOpenclaw plugin for user profile and playbook extraction — learns your preferences, corrections, and workflows across sessions using Openclaw's native memory engine, hooks, and sub-agents. No Reflexio server required.\n\n## Prerequisites\n\n- [Openclaw CLI](https://docs.openclaw.ai) (>= 2026.3.24)\n- Node.js\n\n## Install\n\n```bash\n# 1. Install and enable the plugin\nopenclaw plugins install /path/to/this/directory\nopenclaw plugins enable reflexio-embedded\n\n# 2. Enable the active-memory plugin (required for memory search)\nopenclaw plugins enable active-memory\nopenclaw config set plugins.entries.active-memory.config.agents '[\"*\"]'\n\n# 3. Register .reflexio/ as a memory search path\nopenclaw config set agents.defaults.memorySearch.extraPaths '[\".reflexio/\"]' --strict-json\n\n# 4. Restart the gateway to pick up changes\nopenclaw gateway restart\n```\n\nVerify it loaded:\n\n```bash\nopenclaw plugins inspect reflexio-embedded\n```\n\n## Uninstall\n\n```bash\n# 1. Remove the plugin\nopenclaw plugins disable reflexio-embedded\nopenclaw plugins uninstall --force reflexio-embedded\n\n# 2. Clean up state files\nrm -f ~/.openclaw/reflexio-consolidation-state.json\n\n# 3. Restart the gateway\nopenclaw gateway restart\n```\n\nYour `.reflexio/` user data (profiles and playbooks) is preserved by default. To remove it:\n\n```bash\nrm -rf .reflexio/\n```\n\n## What it does\n\n- **Profile extraction** — automatically captures user preferences, facts, and corrections from conversations into `.reflexio/profiles/`\n- **Playbook capture** — records recurring workflows and patterns into `.reflexio/playbooks/`\n- **Dedup and contradiction resolution** — new entries are compared against existing ones via LLM; overlapping content is merged, contradictions resolved (new wins), and non-contradicted facts preserved\n- **Consolidation** — periodic heartbeat-triggered sweep that clusters similar entries and merges duplicates\n- **TTL management** — profiles can have time-to-live values; expired entries are swept automatically\n\n## Configuration\n\nOverride defaults in your `openclaw.json`:\n\n```json\n{\n  \"plugins\": {\n    \"entries\": {\n      \"reflexio-embedded\": {\n        \"config\": {\n          \"dedup\": { \"shallow_threshold\": 0.4, \"top_k\": 5 },\n          \"consolidation\": { \"threshold_hours\": 24 }\n        }\n      }\n    }\n  }\n}\n```\n\n## Learn more\n\nFull project source, design docs, and development setup:\nhttps://github.com/ReflexioAI/reflexio/tree/main/reflexio/integrations/openclaw-embedded\n\nFile v1.0.10:_meta.json\n\n{\n  \"ownerId\": \"kn76hm02452z7faay8fxk5m65n84wnjm\",\n  \"slug\": \"reflexio\",\n  \"version\": \"1.0.10\",\n  \"publishedAt\": 1776843720084\n}\n\nFile v1.0.10:agents/reflexio-extractor.md\n\n---\nname: reflexio-extractor\ndescription: \"Scoped sub-agent for openclaw-embedded Flow C. Extracts profiles and playbooks from a transcript, then runs shallow pairwise dedup against existing .reflexio/ entries.\"\ntools:\n  - memory_search\n  - file_read\n  - file_write\n  - file_delete\n  - reflexio_write_profile\n  - reflexio_write_playbook\n  - reflexio_search\nrunTimeoutSeconds: 120\n---\n\nYou are a one-shot sub-agent that extracts profiles and playbooks from a conversation transcript, then deduplicates against existing entries in `.reflexio/`.\n\n## Your workflow\n\n1. **Profile extraction**: load `prompts/profile_extraction.md`, substitute `{transcript}` with the provided transcript and `{existing_profiles_context}` with results from `memory_search(top_k=10, filter={type: profile})`. Call `llm-task` with the substituted prompt and output schema. You receive a list of profile candidates.\n\n2. **Playbook extraction**: same process with `prompts/playbook_extraction.md`. You receive a list of playbook candidates.\n\n3. **For each candidate**:\n   For profiles:\n   ```\n   Call the `reflexio_write_profile` tool with: slug=\"<slug>\", ttl=\"<ttl>\", body=\"<content>\"\n   ```\n   For playbooks:\n   ```\n   Call the `reflexio_write_playbook` tool with: slug=\"<slug>\", body=\"<content>\"\n   ```\n   The tools handle dedup + supersession internally — no separate file deletion needed.\n\n4. Exit. Openclaw's file watcher picks up the changes and reindexes.\n\n## Constraints\n\n- Never write secrets, tokens, API keys, or environment variables into `.md` files.\n- On any LLM call failure: skip that candidate, log to stderr, continue.\n- On tool call failure: skip; state unchanged; next cycle retries.\n- You have 120 seconds. If approaching the limit, exit cleanly; any completed writes are durable.\n\n## Tool scope\n\nYou have access only to: `memory_search`, `file_read`, `file_write`, `file_delete`, `reflexio_write_profile`, `reflexio_write_playbook`, `reflexio_search`. You do NOT have `sessions_spawn`, `web`, or network tools.\n\nFile v1.0.10:HEARTBEAT.md\n\n## Reflexio Consolidation Check\n\ntasks:\n  - description: \"Check if reflexio consolidation is due\"\n    tool: reflexio_consolidation_check\n    interval: 24h\n\nFile v1.0.10:prompts/full_consolidation.md\n\n---\nactive: true\ndescription: \"N-way cluster consolidation — produces one-fact-per-file output\"\nchangelog: \"v2 (2026-04-21): one-fact-per-file output; v1 (2026-04-16): initial single-merged-entry design\"\nvariables:\n  - cluster\n---\n\nYou consolidate a cluster of 2-10 similar items (profiles or playbooks) that have accumulated over time.\n\n## Core principle\n\n**One fact per file.** Each output entry must contain exactly ONE atomic fact or preference (1-2 sentences). Do NOT combine unrelated facts into a single entry.\n\n## Inputs\n\nA cluster of items, each with: `id`, `path`, `content`. All items are the same type (all profiles OR all playbooks).\n\n## Decision\n\n- `keep_all` — the cluster items are already distinct single-fact entries with no redundancy. **Prefer this when items cover different topics.**\n- `consolidate` — deduplicate, resolve contradictions, and split into individual facts.\n\nIf the cluster is already well-separated (each item covers a distinct topic with no overlap), return `keep_all` immediately.\n\n### Contradiction handling\n\nIf items contradict on the same topic, keep the most recent version. Explain in `rationale`.\n\n### Deduplication\n\nIf multiple items say the same thing in different words, keep one canonical version.\n\n## Output schema\n\n```json\n{\n  \"action\": \"keep_all | consolidate\",\n  \"facts\": [\n    {\n      \"slug\": \"kebab-case-topic\",\n      \"body\": \"Single atomic fact, 1-2 sentences.\",\n      \"source_ids\": [\"ids of items this fact was derived from\"]\n    }\n  ],\n  \"ids_to_delete\": [\"ids of all original items that are being replaced\"],\n  \"rationale\": \"2-3 sentences justifying the action\"\n}\n```\n\nFor `keep_all`: `facts` is empty, `ids_to_delete` is empty.\nFor `consolidate`: `facts` contains one entry per distinct fact. `ids_to_delete` contains all original cluster IDs being replaced. Every original ID must appear in either `source_ids` of a fact or be explained in `rationale` as removed (contradiction/duplicate).\n\n## Cluster\n\n{cluster}\n\nFile v1.0.10:prompts/playbook_extraction.md\n\n---\nactive: true\ndescription: \"Playbook extraction for Reflexio Embedded plugin (ported from playbook_extraction_context/v2.0.0)\"\nchangelog: \"Initial port (2026-04-16): 6-field output (trigger/instruction/pitfall/rationale/blocking_issue/content) collapsed to 3-field (When/What/Why); autoregressive ordering adapted to Why → What → When internally, emitted as When → What → Why; expert-mode branches (tool_can_use, blocking_issue kinds, agent_context) dropped; strengthened explicit requirement that a confirmation signal must follow any correction before writing a playbook.\"\nvariables:\n  - transcript\n---\n\nYou extract procedural rules (playbooks) from conversations where the user corrected the agent and the correction stuck. Your output becomes entries under `.reflexio/playbooks/`.\n\nYou are a self-improvement policy mining assistant for AI agents. Your job is to extract **generalizable Standard Operating Procedures (SOPs)** that the agent should adopt to avoid repeating mistakes.\n\nYou are NOT extracting:\n- User facts (e.g., \"User is building a React app\") — those belong to the profile extractor.\n- One-off preferences (e.g., \"User likes blue buttons\").\n- Surface phrasing (e.g., \"User said 'don't say that'\").\n\nYou ARE extracting:\n- **Behavioral Policies:** \"When user intent is X, always do Y.\"\n- **Correction Rules:** \"When user encounters problem Z, avoid approach A.\"\n- **Tool Usage Policies:**\n  - Tool selection: \"When user intent is X, use tool Y instead of tool Z.\"\n  - Tool input optimization: \"When using tool Y for intent X, set parameter P to value V.\"\n\n━━━━━━━━━━━━━━━━━━━━━━\n## When to write a playbook (strict)\n\nA playbook is warranted only when **BOTH** of the following are observed in the transcript:\n\n1. **Correction.** The user tells the agent to change its approach. Typical phrases: \"No, that's wrong\", \"Actually…\", \"Don't do X\", \"Not like that\", \"We don't use X here.\" This may also appear as agent self-correction (retrying a tool call with different inputs after poor results, or switching from one tool to another within the same task).\n2. **Confirmation.** After the agent adjusts, the user signals acceptance — either explicitly (\"good\", \"perfect\", \"yes that's right\", \"thanks, that works\") or implicitly (the user moves on to an unrelated topic for 1–2 turns without re-correcting).\n\n**Do NOT write a playbook if you see a correction without a following confirmation.** The fix may itself be wrong; let the batch pass at session end reconsider. A correction with no subsequent signal of acceptance is insufficient evidence that the new behavior is correct.\n\nIn addition, for the candidate playbook to be valid, ALL of the following must be true:\n1. The agent performed an action, assumption, or default behavior.\n2. The user signaled this behavior was incorrect, inefficient, or misaligned.\n3. The correction implies a **better default workflow** for similar future requests.\n4. The rule can be phrased as: *\"When [User Intent/Problem], the agent should [Policy].\"*\n\n━━━━━━━━━━━━━━━━━━━━━━\n## Valid correction signals\n\nLook for cross-turn causal patterns, not isolated messages. Valid signals include:\n- User correcting or rejecting the agent's approach\n- User redirecting the agent to a different mode or level of detail\n- User expressing dissatisfaction with how the agent behaved\n- User clarifying expectations that contradict the agent's behavior\n- Agent retrying a tool call with different inputs after getting poor or irrelevant results (self-correction)\n- Agent switching from one tool to another within the same task after inadequate results\n\nYou MUST identify the triggering agent behavior (assumption made, default chosen, constraint ignored, or question not asked).\n\n━━━━━━━━━━━━━━━━━━━━━━\n## The Skill Test (what makes a good trigger)\n\nA valid **When** trigger must act as a **Skill Trigger** — it describes the **problem or situation**, NOT the user's explicitly stated preference.\n\n- **BAD (Topic-based):** \"User talks about Python code.\" (Too broad)\n- **BAD (Interaction-based):** \"User corrects the agent.\" (Too generic)\n- **BAD (Echoing preference):** \"User requests CLI tools or open-source solutions.\" (Just restates the user's explicit ask — the agent didn't need an SOP to follow direct instructions.)\n- **GOOD (Intent-based):** \"User requests help debugging a specific error trace.\"\n- **GOOD (Problem-based):** \"User's initial high-level request is ambiguous.\"\n- **GOOD (Situation-based):** \"User reports timeout or performance failures on large data transfers (>10TB).\" (Captures the situation where the agent should default to CLI/chunking solutions.)\n\n**Tautology Check.** If the trigger can be reduced to \"user asks for X\" and the action is \"do X\", the playbook is tautological. Re-derive: What was the *problem or situation* where the agent made the wrong default choice? Use THAT as the trigger.\n\n━━━━━━━━━━━━━━━━━━━━━━\n## Reasoning procedure (required)\n\nGenerate each playbook internally in the order **Why → What → When** (rationale conditions the action; both condition the trigger), but **emit** the sections in the document as **When → What → Why**:\n\n1. Identify user turns containing correction, rejection, or redirection.\n2. Trace backwards to the exact agent behavior that triggered it.\n3. Identify the violated implicit expectation — this is the seed of **Why**.\n4. Verify a confirmation signal follows within 1–2 turns. If not, abandon this candidate.\n5. Define the SOP action — this becomes **What**. Include DOs and DON'Ts only as they were actually observed in this conversation. Do not force DO/DON'T symmetry if only one side was learned; forcing symmetry leads to hallucinated pitfalls.\n6. Draft the SOP trigger — this becomes **When**. Apply the Skill Test and Tautology Check.\n7. Check that the trigger is the search anchor a future agent would retrieve on. Rewrite as a concise noun phrase describing the *situation*, not a sentence.\n8. Repeat steps 1–7 for **every distinct** behavioral issue you identified. Each independent policy becomes a separate entry in the output list.\n\n━━━━━━━━━━━━━━━━━━━━━━\n## Output format\n\nEach playbook has three body sections: `## When`, `## What`, `## Why`.\n\n- `## When` — One-sentence trigger phrase. This is the search anchor used for retrieval. Write as a noun phrase describing the *situation*, not a sentence. Apply the Skill Test.\n- `## What` — 2–3 sentences of the actual procedural rule. Include DOs and DON'Ts as they were actually observed — do not force DO/DON'T symmetry if only one was learned.\n- `## Why` — Rationale. Reference the specific correction+confirmation evidence from the transcript when helpful. Can be longer than the other sections — it is reference material, not recall content.\n\nReturn a JSON array of objects. If nothing to extract, return `[]`.\n\n```json\n[\n  {\n    \"topic_kebab\": \"commit-no-ai-attribution\",\n    \"when\": \"Composing a git commit message on this project.\",\n    \"what\": \"Write conventional, scope-prefixed messages. Do not add AI-attribution trailers like `Co-Authored-By`.\",\n    \"why\": \"On [date] the user corrected commits that included Co-Authored-By trailers. Project's git-conventions rule prohibits them. Correction stuck — the user's next request assumed the rule was internalized.\"\n  }\n]\n```\n\n- `topic_kebab`: kebab-case slug, ≤ 48 chars, regex `^[a-z0-9][a-z0-9-]*$`. A compression of the situation the rule applies to (e.g., `commit-no-ai-attribution`, `debug-explain-root-cause-first`, `search-specific-query-first`).\n\n━━━━━━━━━━━━━━━━━━━━━━\n## Examples\n\n**Example 1 (single entry):**\n- **Agent:** Jumps directly into code generation.\n- **User:** \"Don't give me the code yet, explain the strategy first.\"\n- **Agent:** Outlines strategy.\n- **User:** \"Good, now proceed.\"  ← confirmation\n\n```json\n[\n  {\n    \"topic_kebab\": \"strategy-before-code\",\n    \"when\": \"User asks for architectural advice or complex implementation help.\",\n    \"what\": \"Outline the high-level strategy before generating code. Do not jump straight to code when the user has not explicitly asked for it.\",\n    \"why\": \"The agent assumed the user wanted code immediately, but the user needed to understand the approach first. Presenting strategy first prevents wasted effort on wrong approaches and gives the user the understanding they need to evaluate the plan.\"\n  }\n]\n```\n\n**Example 2 (single entry):**\n- **Agent:** Suggests `pip install …`.\n- **User:** \"Stop using pip, I'm using poetry.\"\n- **Agent:** Reissues command as `poetry add …`.\n- **User:** \"Thanks.\"  ← confirmation\n\n```json\n[\n  {\n    \"topic_kebab\": \"detect-package-manager\",\n    \"when\": \"User asks for package installation commands.\",\n    \"what\": \"Detect or ask for the project's package manager preference before suggesting install commands.\",\n    \"why\": \"The agent defaulted to pip without checking the project setup, which produced commands incompatible with the user's poetry-based workflow. Detecting the package manager first avoids this whole class of mistakes.\"\n  }\n]\n```\n\n**Example 3 (tool input optimization via retry pattern):**\n- **Agent:** `[used tool: search_docs({\"query\": \"error\"})]` → irrelevant results.\n- **Agent:** `[used tool: search_docs({\"query\": \"TypeError in async handler\", \"filter\": \"error_logs\"})]` → relevant results.\n- **User:** \"Perfect, that's the one.\"  ← confirmation\n\n```json\n[\n  {\n    \"topic_kebab\": \"search-specific-query-first\",\n    \"when\": \"Agent is searching docs for a specific error or issue the user reported.\",\n    \"what\": \"Use the exact error message and relevant filters as search parameters on the first attempt.\",\n    \"why\": \"On the first attempt the agent used a vague single-word query and wasted a round-trip. The second attempt, with the exact error text and an error_logs filter, succeeded immediately. Specific queries on the first call reduce latency and cost.\"\n  }\n]\n```\n\n**Example 4 (avoiding tautological triggers):**\n- **User:** Reports S3 sync timeout on 12 TB backup. Agent suggests UI settings. User says \"I need CLI-based automation.\" Agent suggests a proprietary tool. User says \"I want open-source only.\" Agent finally suggests rclone with chunking. User: \"That works.\"  ← confirmation\n\n- **BAD (Tautological) — do NOT emit:**\n```json\n[{\"when\": \"User requests CLI or open-source automation tools.\", \"what\": \"Suggest CLI/open-source tools.\", \"why\": \"…\"}]\n```\nThis just echoes the correction. The agent doesn't need an SOP to follow explicit instructions.\n\n- **GOOD:**\n```json\n[\n  {\n    \"topic_kebab\": \"large-transfer-cli-chunking\",\n    \"when\": \"User reports timeout or performance failure transferring large datasets (>10 TB) to cloud storage.\",\n    \"what\": \"Default to CLI-based chunking / parallel transfer solutions (e.g., rclone) and provide config snippets.\",\n    \"why\": \"The agent defaulted to GUI settings and then to a proprietary tool for a large-data transfer problem, both of which the user rejected before rclone with chunking finally worked. CLI-based chunking is the standard solution for transfers at this scale — extract the *situation* (large transfer timeout), not the user's tool preference.\"\n  }\n]\n```\n\n**Example 5 (multiple distinct entries from one conversation):**\n- **Conversation:** Multi-turn debugging session. (a) User asks for help fixing a `TypeError` but the agent jumps straight to code rewrites instead of explaining the root cause; after the user says \"explain first\", agent does so, user says \"good\". (b) The agent apologizes (\"I'm sorry for the confusion\") every time it provides a factual correction, even when no mistake occurred; user says \"stop apologizing, just tell me what's correct\"; agent complies; session continues.\n\nBoth corrections have matching confirmations, so both become playbooks:\n\n```json\n[\n  {\n    \"topic_kebab\": \"debug-explain-root-cause-first\",\n    \"when\": \"User asks for help debugging a specific error trace.\",\n    \"what\": \"Explain the root cause of the error before proposing any code changes. Do not jump straight to rewriting code.\",\n    \"why\": \"The user needs to understand why the error occurred in order to evaluate the fix. Skipping the explanation leaves them without the context they need and leads to repeated back-and-forth.\"\n  },\n  {\n    \"topic_kebab\": \"corrections-no-unnecessary-apology\",\n    \"when\": \"Agent provides a factual correction or updated diagnosis during a multi-turn session.\",\n    \"what\": \"Deliver the correction plainly. Do not preface routine corrections with an apology when no actual mistake occurred.\",\n    \"why\": \"Apologies on every refinement eroded user confidence. Reserve apologies for genuine errors so they retain meaning.\"\n  }\n]\n```\n\n━━━━━━━━━━━━━━━━━━━━━━\n## Rules for output fields\n\n- The top-level response MUST be a JSON array (possibly empty).\n- Each entry MUST have `topic_kebab`, `when`, `what`, `why`. All four are REQUIRED.\n- `when` is the search anchor — keep it short, situation-focused, and Skill-Test-valid.\n- `what` captures only DOs and DON'Ts that the conversation actually evidenced. Do NOT invent a symmetric DON'T for every DO (or vice versa).\n- `why` must reference the specific agent behavior that triggered the correction AND confirm that a confirmation signal followed.\n- Each entry must describe a **distinct, independent** policy — do not split one policy across entries, and do not merge two independent policies into one.\n- If any candidate fails the confirmation gate, the Skill Test, or the Tautology Check, drop it.\n- Vague, stylistic, or unanchored advice is invalid.\n- **Never capture secrets or credentials in a playbook.** If a correction or execution trace contains API keys, tokens, passwords, or other credential material, redact that content from the `why` field before emitting the playbook. Do not emit a playbook whose `why` requires quoting credentials verbatim.\n\n## Transcript\n\n{transcript}\n\nFile v1.0.10:prompts/profile_extraction.md\n\n---\nactive: true\ndescription: \"Profile extraction for Reflexio Embedded plugin (ported from profile_update_instruction_start/v1.0.0)\"\nchangelog: \"Initial port (2026-04-16): output adapted from StructuredProfilesOutput JSON to list of {topic_kebab, content, ttl} suitable for the reflexio_write_profile tool; custom_features and metadata fields dropped; existing_profiles variable now injected from memory_search results rather than Reflexio server.\"\nvariables:\n  - existing_profiles_context\n  - transcript\n---\n\nYou extract durable user facts from conversations. Your output becomes entries under `.reflexio/profiles/`.\n\n[Goal]\nYou are a user personalization learning assistant. Your job is to analyze user–agent interactions and extract **salient information about the user** that should shape how an AI agent communicates with and serves this user in future conversations.\n\nA \"profile\" can be:\n- **Factual information**: Direct facts about the user (name, birthday, occupation, location)\n- **Work & expertise**: Professional role, technical skills, domain knowledge, tools used daily\n- **Goals & projects**: Current objectives, ongoing projects, deadlines, milestones\n- **Life circumstances**: Living situation, health considerations, family context, time constraints\n- **Relationships & family**: Family members, pets, key people in their life\n- **Domain / environment facts**: Stable facts about the user's working environment that the agent needs to know to serve them correctly — schema details (table names, column types, units of measurement), join paths, metric definitions the user enforces, tool quirks or limitations the user works around, file-format conventions, and similar reference knowledge. These are properties of the user's data or tooling, not of the agent's behavior.\n- **Inferred personalization signals**: Patterns derived from behavior or multi-turn inference that would cause an agent to meaningfully change how it responds\n\nProfiles may be extracted from:\n- Explicit statements (\"I prefer sushi\")\n- Implicit signals (implied preference/acceptance/rejection)\n- Multi-turn inference (a stable pattern across multiple turns where the user never explicitly states a preference, but behavior suggests one)\n\n**Scope boundary — what is NOT a profile:**\nProfiles capture what is *true about the user or their world*. They do NOT capture\n*what the agent should do differently next time*. If a learning is a behavioral\nrule for the agent (e.g., \"when the user asks about methodology, stop and propose\na corrected plan before re-running queries\", \"always explain root cause before\nproposing code changes\"), it belongs in the playbook extractor, not here. Extract\nonly the stable facts the agent needs to know; leave the action rules to playbooks.\n\n[Your Task — Follow These Steps]\n\nSTEP 1: Analyze and reason through the user interactions below and compare them to the existing profiles shown in the `{existing_profiles_context}` section.\n\nSTEP 2: Decide what to extract:\n- If the interaction reveals NEW information about the user that is NOT already stored in existing profiles → Extract it as a new profile\n- If the information is already in existing profiles → Do NOT re-extract it\n- If the interaction contains NO relevant profile information → Return an empty list\n\nSTEP 3: For each profile you extract, you must assign:\n- `topic_kebab`: short kebab-case slug, ≤ 48 chars, regex `^[a-z0-9][a-z0-9-]*$`. A semantic compression of the fact (e.g., `diet-vegetarian`, `role-backend-engineer`, `schema-orders-gross-cents`).\n- `content`: 1–3 sentences, one fact per entry, written as a standalone statement about the user.\n- `ttl`: one of the values from the TTL table below.\n\n[Time to Live — Choose One]\n- `infinity` → Facts that rarely change (name, birthday, gender, phone number)\n- `one_year` → Long-term preferences and slow-moving context (favorite color, hobby, long-lived schema facts)\n- `one_quarter` → Seasonal preferences or quarter-scoped projects (winter activities, holiday traditions, Q-end deadlines)\n- `one_month` → Regular preferences (food preferences, UI preferences)\n- `one_week` → Short-term or situational preferences (current project, temporary need)\n- `one_day` → Very short-lived context (today's deadline, scratch preference)\n\n[Output Format]\nReturn a JSON array of objects. Each object represents one profile to write. If nothing to extract, return `[]`.\n\n```json\n[\n  {\n    \"topic_kebab\": \"diet-vegetarian\",\n    \"content\": \"User is vegetarian — no meat or fish.\",\n    \"ttl\": \"infinity\"\n  }\n]\n```\n\n[Examples With Explanations]\n\nExample 1 — Extracting a new profile:\n- Existing profiles: none related\n- Interaction: \"i like to eat pizza\"\n- Reasoning: User revealed a food preference. Not in existing profiles. Food preferences change monthly, so ttl is `one_month`.\n```json\n[{\"topic_kebab\": \"food-likes-pizza\", \"content\": \"User likes pizza.\", \"ttl\": \"one_month\"}]\n```\n\nExample 2 — Extracting a permanent profile:\n- Interaction: \"my name is John\"\n- Reasoning: User's name is a permanent fact. Use `infinity`.\n```json\n[{\"topic_kebab\": \"name-john\", \"content\": \"User's name is John.\", \"ttl\": \"infinity\"}]\n```\n\nExample 3 — Extracting work context and project:\n- Existing profiles: none\n- Interaction: \"I'm a senior backend engineer at Acme Corp, currently migrating our payment service from monolith to microservices. The deadline is end of Q2.\"\n- Reasoning: Role is long-lived; the migration project is quarter-scoped.\n```json\n[\n  {\"topic_kebab\": \"role-senior-backend-acme\", \"content\": \"User is a senior backend engineer at Acme Corp.\", \"ttl\": \"one_year\"},\n  {\"topic_kebab\": \"project-payments-microservices\", \"content\": \"User is migrating Acme's payment service from monolith to microservices, with an end-of-Q2 deadline.\", \"ttl\": \"one_quarter\"}\n]\n```\n\nExample 4 — No relevant information:\n- Interaction: \"what time is it?\"\n- Reasoning: Nothing to extract.\n```json\n[]\n```\n\nExample 5 — Domain / environment fact surfaced through error correction:\n- Existing profiles: none\n- Interaction: Agent attempts `SUM(orders.total_amount)` and fails with \"unknown column 'total_amount'\". Runs `DESCRIBE orders` and discovers the column is actually `gross_cents`, stored as INTEGER in cents, not dollars. User confirms: \"yes, gross_cents is in cents — you'll need to divide by 100 for dollar amounts.\"\n- Reasoning: This is a stable fact about the user's data schema (column name, type, unit). Store as a long-lived domain fact.\n```json\n[{\"topic_kebab\": \"schema-orders-gross-cents\", \"content\": \"orders.gross_cents stores order revenue as INTEGER in cents (not dollars) — divide by 100 for dollar amounts.\", \"ttl\": \"one_year\"}]\n```\n\nNote: if the same session also surfaces a behavioral rule (e.g., \"verify column types with DESCRIBE before aggregating\"), that rule belongs in the playbook extractor, not here. This example captures only the fact.\n\n[Important Reminders]\n1. Only extract profiles that represent salient, stable facts about the user or their world.\n2. If the information is already captured in existing profiles (see below), do NOT re-extract it.\n3. Always include `ttl` for new profiles; pick the shortest TTL that the fact will plausibly remain true for.\n4. Never output behavioral rules for the agent here — those belong to the playbook extractor.\n5. **Never extract secrets or credentials.** Do not create profile entries for API keys, access tokens, passwords, OAuth secrets, private keys, auth headers, `.env` values, connection strings, or any other credential-shaped content, even if the user pasted such content into the conversation. Treat those as noise; skip them.\n6. Return `[]` when there is nothing new to extract.\n\n## Existing profiles for context (do NOT re-extract these)\n\n{existing_profiles_context}\n\n## Transcript\n\n{transcript}\n\nFile v1.0.10:skill-card.md\n\n## Description:\n\nCaptures user facts and procedural corrections into .reflexio/ so the agent can retrieve relevant memory across sessions.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[yyiilluu](https://clawhub.ai/user/yyiilluu)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers and agent users use Reflexio to preserve useful preferences, facts, procedural corrections, and workflow playbooks across OpenClaw sessions.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The skill stores long-term memory from conversations in plaintext .reflexio files.\n\nMitigation: Use it only in workspaces where durable conversation memory is intended, and avoid sessions containing secrets or sensitive data.\n\nRisk: The skill modifies persistent workspace instructions through HEARTBEAT.md and active-memory configuration.\n\nMitigation: Review the heartbeat block and active-memory scope before enabling the plugin.\n\nRisk: Session-end extraction and consolidation can write, merge, or delete memory entries automatically.\n\nMitigation: Review generated .reflexio profiles and playbooks periodically and remove incorrect or unwanted entries.\n\n## Reference(s):\n\n- [Reflexio on ClawHub](https://clawhub.ai/yyiilluu/skills/reflexio)\n- [OpenClaw Documentation](https://docs.openclaw.ai)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, shell commands, configuration, guidance]\n\n**Output Format:** [Markdown memory files plus text and JSON tool results]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Creates and searches .reflexio/ profile and playbook files; includes TTL, deduplication, and consolidation behavior.]\n\n## Skill Version(s):\n\n1.0.10 (source: ClawHub release metadata)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nArchive v1.0.9: 10 files, 35751 bytes\n\nFiles: commands/reflexio-aggregate/SKILL.md (2856b), commands/reflexio-extract/SKILL.md (8077b), hook/handler.js (16340b), hook/HOOK.md (4885b), hook/package.json (502b), README.md (14525b), rules/reflexio.md (3472b), SKILL.md (22824b), skill/SKILL.md (16030b), _meta.json (127b)\n\nFile v1.0.9:commands/reflexio-aggregate/SKILL.md\n\n---\nname: reflexio-aggregate\ndescription: \"Aggregate user playbooks from all OpenClaw instances into shared agent playbooks. Use when you want to consolidate learnings across all agents.\"\n---\n\n# Aggregate Learnings into Shared Agent Playbooks\n\nAggregate user playbooks collected across all OpenClaw instances into shared agent playbooks that every agent can search.\n\n## What Aggregation Does\n\nEach time a conversation is extracted (via `/reflexio-extract` or the automatic hook), the learnings are stored as **user playbooks** — behavioral rules tied to a specific user and agent instance. Aggregation goes one step further: it clusters similar user playbooks from all instances, deduplicates overlapping rules, and produces **agent playbooks** — shared behavioral guidelines available to every OpenClaw agent, regardless of which instance or user originally generated the learning.\n\nThis means a correction one agent learned from one user can benefit every agent going forward.\n\n## How to Aggregate\n\n1. Ensure the local Reflexio server is running. This integration always talks to `http://127.0.0.1:8081`:\n\n```bash\nreflexio status check\n```\nIf not running, tell the user you're starting it in the background, then:\n```bash\nnohup reflexio services start --only backend > ~/.reflexio/logs/server.log 2>&1 &\nsleep 5\n```\n\n2. Run aggregation and wait for results:\n\n```bash\nreflexio agent-playbooks aggregate --agent-version openclaw-agent --wait\n```\n\nThe `--wait` flag blocks until the aggregation job completes and prints a summary of how many playbooks were created or updated. Aggregation runs an LLM clustering pass over all user playbooks for the `openclaw-agent` version, so it may take 30–60 seconds depending on volume.\n\n3. Report results to the user: how many agent playbooks were created or updated, and what themes emerged (if the output includes them).\n\n4. Suggest reviewing the new agent playbooks:\n\n```bash\nreflexio agent-playbooks list --agent-version openclaw-agent\n```\n\nThis shows all shared behavioral rules now available to every OpenClaw agent on the next `reflexio search` call.\n\n## Setting Up Regular Aggregation\n\nFor teams running OpenClaw continuously, set up a cron job to aggregate periodically so shared playbooks stay fresh:\n\n```bash\n# Run aggregation daily at 3am\n0 3 * * * reflexio agent-playbooks aggregate --agent-version openclaw-agent --wait >> ~/.reflexio/logs/aggregate.log 2>&1\n```\n\nAlternatively, configure aggregation to run automatically after each publish by setting `auto_aggregate: true` in your Reflexio server config:\n\n```bash\nreflexio config set --data '{\"auto_aggregate\": true}'\n```\n\nWith `auto_aggregate` enabled, you only need to run this command manually when you want an immediate consolidation — for example, after a batch of high-friction sessions where you want the learnings available right away.\n\nFile v1.0.9:commands/reflexio-extract/SKILL.md\n\n---\nname: reflexio-extract\ndescription: \"Summarize the current conversation — including reasoning, tool calls, corrections, and preferences — and publish to Reflexio for user profile and playbook extraction.\"\n---\n\n# Extract Learnings to Reflexio\n\nSummarize this conversation and publish to Reflexio so future sessions can learn from it.\n\n## What to Do\n\nReview the full conversation above, including your chain-of-thought reasoning, tool calls, tool results, and all user messages. Create a summary that captures:\n\n1. **User corrections** — the user said \"no, do X instead\" or corrected your approach. Preserve their exact words. **Tool-call rejections count as corrections** — if the user rejected a tool use mid-response, record it as its own turn and note what the rejection was objecting to.\n2. **User preferences** — how they like things done, their expertise, communication style, project conventions.\n3. **Environment facts** — project setup, tools, constraints, team conventions, schema details, column types, undocumented quirks.\n4. **Procedural signals** — moments where something went wrong and you learned from it. **These are the primary source of behavioral rules** — without them, Reflexio can only extract vague profile entries, not precise playbook rules:\n   - **Failed tool calls with their error messages verbatim** (invalid identifier, file too large, permission denied, timeouts, JSON parse errors, etc.) — the exact error string is load-bearing evidence\n   - **Self-corrections mid-response** — moments you wrote \"actually…\", \"this isn't quite X but…\", or \"I should have…\" (these are evidence the user would have valued catching the mistake earlier)\n   - **Anomalies and implausible results** — mean/median divergence, unexpected zeros, row-count mismatches, results that contradict documentation\n   - **Retries and the reason for each retry** — not just the final successful call\n5. **Non-obvious learnings** — surprises, dead ends, workarounds, documentation gaps.\n\nSkip routine pleasantries, but do **NOT** skip failures, rejections, or anomalies — these are the highest-signal moments. If a section of the conversation contains only successful tool calls and no friction, it probably yields domain facts; if it contains friction, it probably yields behavioral rules. Both layers matter.\n\n## How to Publish\n\n1. Ensure the local Reflexio server is running. This integration always talks to `http://127.0.0.1:8081` — it does not support remote servers.\n\n```bash\nreflexio status check\n```\n\nIf not running, tell the user you're starting it in the background, then:\n```bash\nnohup reflexio services start --only backend > ~/.reflexio/logs/server.log 2>&1 &\nsleep 5\n```\n\n2. Use your own agent identity as `user_id` — the agent name or instance identifier configured for this OpenClaw agent. The Reflexio CLI will auto-derive it from OpenClaw's session key if you leave it out of the payload.\n\n3. Write the summary as a JSON file. **Pattern-match on the shape below**: a single assistant turn captures one coherent learning; failed attempts plus the eventual success live together as an ordered list in `tools_used` so the failure → recovery arc reads as one unit. Self-corrections belong **verbatim** inside the `content` field:\n\n```bash\ncat > /tmp/reflexio-extract.json << 'EXTRACT_EOF'\n{\n  \"user_id\": \"<your-agent-id>\",\n  \"agent_version\": \"openclaw-agent\",\n  \"source\": \"openclaw-expert\",\n  \"interactions\": [\n    {\"role\": \"user\", \"content\": \"how many live streams had a giveaway in the last 6 months?\"},\n    {\n      \"role\": \"assistant\",\n      \"content\": \"Tried to query live_streams with a channels join to filter by business type; discovered live_streams has no channel_id column. Fell back to SELECT * LIMIT 1 for schema introspection, then rewrote the query without the channels join. Got 588 streams. NOTE: mid-response I wrote 'this is not true CVR' — I had substituted engagement_rate for conversion rate without flagging the substitution upfront.\",\n      \"tools_used\": [\n        {\"tool_name\": \"run_query\", \"tool_data\": {\"input\": \"SELECT ... JOIN channels ... — FAILED: invalid identifier 'L.CHANNEL_ID'\"}},\n        {\"tool_name\": \"run_query\", \"tool_data\": {\"input\": \"SELECT * FROM live_streams LIMIT 1 — schema introspection\"}},\n        {\"tool_name\": \"run_query\", \"tool_data\": {\"input\": \"Rewritten query without channels join — succeeded, returned 588\"}}\n      ]\n    }\n  ]\n}\nEXTRACT_EOF\n```\n\nNotice the three things the example models: (1) the `content` field names the failure, the recovery, **and** the self-correction verbatim; (2) all three tool attempts — failed, introspection, success — are listed in order under the **same** `tools_used` so the arc is one learning unit; (3) the failed attempt's `input` ends with `— FAILED: <exact error>` so the error string survives intact.\n\n`tools_used` is **required** for any assistant turn containing a failed, rejected, or retried tool call. The error message and the offending input are what make behavioral rules extractable — include them verbatim. For purely successful tool calls that only yielded a domain fact already captured in the `content` field, `tools_used` is optional.\n\n4. **Self-check before publishing.** Scan your JSON and ask:\n   1. Does it contain at least one failed tool call, user rejection, or self-correction? If the original conversation had any friction and your summary has none, re-read the conversation for the failure moments you dropped.\n   2. For each failed tool call, is the **actual error message present verbatim** (not paraphrased)? Error strings like `invalid identifier 'L.CHANNEL_ID'` are what let Reflexio extract behavioral rules — paraphrases lose the signal.\n   3. Are retries grouped under the **same** assistant turn as an ordered list, so the failure → recovery arc reads as one learning?\n\n   If any answer is no, revise the JSON before running the publish command below. A re-extraction after publish is possible but costs a round trip.\n\n5. Publish with forced extraction (replace `<your-agent-id>` with the resolved user ID from step 2):\n```bash\nreflexio publish --user-id <your-agent-id> --agent-version openclaw-agent --source openclaw-expert --skip-aggregation --force-extraction --file /tmp/reflexio-extract.json && rm -f /tmp/reflexio-extract.json\n```\n\nThe publish returns as soon as the server has accepted the payload — the actual extraction (LLM calls + storage writes) runs as a background task on the server. This avoids the gateway timeouts you'd hit if extraction took longer than the deployment's request budget.\n\n6. Report what was published (brief summary to the user) and tell them the extraction is running in the background. They can verify the results a minute later with:\n```bash\nreflexio user-profiles list --user-id <your-agent-id> --limit 10\nreflexio user-playbooks list --user-id <your-agent-id> --limit 10\n```\n\n## Summary Guidelines\n\n- **Preserve user corrections and tool rejections verbatim** — their exact words (or the rejection moment) are the highest-signal input.\n- **Preserve failures, not just successes.** For every failed tool call, record the error message and the input that caused it. For every retry, record why you retried. A summary with zero failures in a conversation that had friction is an incomplete summary.\n- **Preserve self-corrections.** If you wrote \"this isn't quite X\" or \"I should have done Y\" in the original conversation, that sentence belongs in the extraction verbatim — it is evidence of a rule the user values.\n- **Organize as meaningful pairs** — each user/assistant pair should capture one coherent learning. Multiple failed attempts + the eventual success belong to the **same** assistant turn, listed in order in `tools_used`, so the failure → recovery arc is preserved as a single learning unit.\n- **Include reasoning context** — why you took an approach, what you expected, what surprised you.\n- **Be concise, but not at the cost of dropping failures.** Cut pleasantries and repeated narration, not error messages.\n\nFile v1.0.9:SKILL.md\n\n---\nname: reflexio\ndescription: \"Self-improving OpenClaw agents via Reflexio cross-session memory: the agent learns from every correction, tool failure, and stated preference so it stops repeating the same mistakes. Searches past playbooks before each task, captures new learnings after — and cross-instance aggregation turns one agent's correction into shared knowledge for every other agent. The hook is hard-pinned to a local Reflexio server at 127.0.0.1:8081 (no remote endpoints). That local server performs LLM-based extraction using whatever provider you configure in ~/.reflexio/.env, so extracted summaries may reach third-party APIs — see Privacy section before enabling.\"\nmetadata:\n  openclaw:\n    homepage: https://github.com/reflexio-ai/reflexio/tree/main/reflexio/integrations/openclaw\n    emoji: 🧠\n    requires:\n      bins: [reflexio]\n---\n\n## Privacy & Data Collection — Read This First\n\n**This skill causes the agent to automatically capture conversations and\nforward them to a local Reflexio server for LLM-based extraction.** Read this\nbefore enabling — there are two distinct network hops and you need to\nunderstand both.\n\n### Credential requirement (not declared in skill metadata)\n\nThe skill's registry metadata declares no required environment variables and\nthe hook reads none. **But the end-to-end system does require an LLM provider\nAPI key**, and you WILL be asked for one during First-Use Setup.\n\n- Step 2 of First-Use Setup below runs `reflexio setup openclaw`, which opens\n  an **interactive wizard** prompting you to choose an LLM provider (OpenAI,\n  Anthropic, Gemini, DeepSeek, OpenRouter, and several others) and paste an\n  API key.\n- The key is stored in `~/.reflexio/.env` and read by the local Reflexio\n  server during extraction. **The hook itself never reads the key** (the hook\n  has no environment variable access and no filesystem config reads — both\n  enforced in `handler.js`).\n- If you want fully offline operation, point the wizard at a local LLM\n  (Ollama at `http://127.0.0.1:11434`, LM Studio, vLLM, etc.) instead of a\n  hosted provider — the wizard accepts any LiteLLM-compatible base URL.\n\n**Why the metadata doesn't declare it:** ClawHub's `metadata.openclaw.requires.env`\ndescribes environment variables the hook's own code path reads. The hook is\ndeliberately stateless at the credential level, so listing anything there\nwould be inaccurate. The dependency is at the *backend server* level, one\nhop away. This disclosure is here instead of in the metadata because prose\nis the right place to explain the distinction.\n\n### Network hops — two of them\n\n**Hop 1: the hook → the local Reflexio server (always localhost).**\nThe hook is hard-pinned to `http://127.0.0.1:8081`. It communicates via native\n`fetch()` with no configuration knobs; the destination is a hardcoded constant\nin `handler.js`. It reads zero environment variables and zero configuration\nfiles. This hop cannot leave your machine.\n\n**Hop 2: the local Reflexio server → an LLM provider (may leave your\nmachine).** The server uses an LLM provider (OpenAI, Anthropic, Gemini,\nDeepSeek, etc.) to extract playbooks and profiles from captured conversations.\nThat provider is configured in `~/.reflexio/.env`. **If you configured an\nexternal provider, excerpts of your conversations will be sent to that\nprovider** as part of extraction — trigger text, sample content, and enough\ncontext for the extractor to produce a useful summary. The primary full\nconversation text stays in your local SQLite database at `~/.reflexio/`, but\nthe extracted summaries and illustrative excerpts traverse whatever the LLM\nprovider's network path is.\n\n**If you want fully offline operation**, configure the local server to use a\nlocal LLM (Ollama, LM Studio, vLLM, etc.) before enabling this skill. Do not\nrely on the hook's localhost pinning as a privacy guarantee for the system as\na whole — that only bounds the hook, not the server behind it.\n\n**What is captured:** full user and assistant messages; every tool call, input,\nand output (including failed tool calls and exact error strings); self-correction\ntext from the assistant's own output. None of this is scrubbed for PII,\ncredentials, file paths, or API outputs. If you work on sensitive tasks,\ndisable the hook before starting them, or tell the agent mid-task.\n\n**How to disable:**\n\n- Per-session, stop automatic capture: `openclaw hooks disable reflexio-context`\n- Remove the integration entirely: `reflexio setup openclaw --uninstall`\n- Search-only mode (keep retrieval, drop auto-publish): edit `hook/handler.js`,\n  remove the `command:stop` handler, and reinstall\n- Sensitive task: tell the agent \"don't log this\" — the workspace rule instructs\n  it to stop all capture and search calls for the rest of the session\n\n**Transparency contract:** the agent is instructed to tell you Reflexio is\nactive on the first turn of each session, disclose what is captured AND\nmention that the local server may forward excerpts to an LLM provider, and\nhonor session-level opt-outs. This is enforced by\n`~/.openclaw/workspace/reflexio.md`. Edit that file if your deployment needs\ndifferent rules (require explicit approval before every publish, offline-only,\netc).\n\nFull data-handling details live in the **Privacy & Data Collection** section\nfurther down in this SKILL.md.\n\n---\n\n\n## First-Use Setup\n\nRun these commands the first time this skill is invoked. They are idempotent —\nskip if `reflexio` is already on PATH, the local Reflexio server is responding\nat `http://127.0.0.1:8081/health`, and `openclaw hooks list` shows\n`reflexio-context` as `ready`. **Only run them after reading the privacy\ndisclosure above, and be aware that step 2 is interactive — it will prompt\nyou to pick an LLM provider and paste an API key for the local server's\nextraction pipeline.**\n\n```bash\n# 1. Install the reflexio CLI (pipx preferred; pip as fallback).\ncommand -v reflexio >/dev/null 2>&1 \\\n  || pipx install reflexio-ai 2>/dev/null \\\n  || pip install --user reflexio-ai\n\n# 2. INTERACTIVE: activates the hook, slash commands, and workspace rule in\n# OpenClaw. Also prompts you to choose an LLM provider and paste an API key,\n# which gets written to ~/.reflexio/.env. That key is what the local server\n# uses to extract playbooks from captured conversations. Point at a local LLM\n# (Ollama / LM Studio / vLLM) here if you want fully offline operation.\n# Before running this, tell the user what will be asked and why.\nreflexio setup openclaw\n\n# 3. Start the local Reflexio backend in the background. The hook talks to\n# this server via HTTP on 127.0.0.1:8081 — it will NOT start the server for\n# you. Tell the user you are doing this before running it.\ncurl -sf --max-time 2 http://127.0.0.1:8081/health >/dev/null 2>&1 \\\n  || (nohup reflexio services start --only backend \\\n        >> ~/.reflexio/logs/server.log 2>&1 & \\\n      sleep 5)\n```\n\nThis installs:\n\n- `reflexio-context` hook — HTTP-only capture + per-message playbook\n  injection (communicates only with `http://127.0.0.1:8081`)\n- `/reflexio-extract` slash command — publish session learnings mid-session\n- `/reflexio-aggregate` slash command — consolidate user playbooks into\n  shared agent playbooks\n- `~/.openclaw/workspace/reflexio.md` — always-active behavioral rule\n  (transparency + opt-out handling)\n\nIf the local server is unreachable, the hook logs the error and the agent\ncontinues the user's task without Reflexio context that session.\n\n---\n\n\n# Reflexio: Learn from Past Sessions\n\nReflexio remembers corrections and preferences from past conversations with this user. Use it to retrieve task-specific guidance before working, and to record new learnings as you go.\n\n**This skill triggers on TWO types of messages:**\n1. **Task requests** — user asks you to do something → search Reflexio first\n2. **Corrections, preferences, and completed steps** → publish to Reflexio\n\nThe user can also run `/reflexio-extract` for comprehensive extraction of all session learnings, or `/reflexio-aggregate` to consolidate learnings across all agent instances.\n\n---\n\n## Privacy & Data Collection\n\n**Read this before enabling the skill.** Reflexio causes the agent to automatically capture conversations and forward them to a local Reflexio server for extraction and storage. Treat the following as material privacy information, not incidental detail.\n\n### Credential requirement (not declared in skill metadata — important)\n\nThe skill itself declares no required environment variables and the hook reads none. **But the end-to-end system does require an LLM provider API key**, and you will be asked for one during First-Use Setup:\n\n- `reflexio setup openclaw` runs an interactive wizard that prompts you to choose an LLM provider (OpenAI, Anthropic, Gemini, DeepSeek, OpenRouter, MiniMax, DashScope, xAI, Moonshot, ZAI, or any local provider via LiteLLM) and paste an API key.\n- The key is written to `~/.reflexio/.env`. The local Reflexio server reads it when extracting playbooks and profiles from captured conversations.\n- **The hook itself never reads this key or sees the contents of `~/.reflexio/.env`.** That's a property of the hook code, which has no filesystem config reads and no environment variable access at all. But the *server* the hook POSTs to does read the key, so from a \"what credentials will I end up providing to make this work\" perspective, treat the LLM provider key as a required dependency of the skill.\n- **If you want fully offline operation, point the wizard at a local LLM** (Ollama at `http://127.0.0.1:11434`, LM Studio, vLLM, etc.) instead of a hosted provider. The wizard accepts any LiteLLM-compatible base URL.\n\nThis credential is not declared in the skill's registry metadata because metadata-level `requires.env` only applies to the hook's own runtime reads, and the hook is deliberately stateless. But you should know it's coming before you install.\n\n### Two distinct network hops — know the difference\n\n1. **The hook → the local Reflexio server (always localhost).**\n   The hook is hard-pinned to `http://127.0.0.1:8081`. It communicates via native `fetch()` with no configuration knobs; the destination is a hardcoded constant in `handler.js`. It reads no environment variables and no dotfiles. This hop cannot leave your machine.\n\n2. **The local Reflexio server → an LLM provider (may leave your machine).**\n   The server uses an LLM provider (configured via `~/.reflexio/.env`) to extract playbooks and profiles from captured conversations. That provider is whichever one you set — OpenAI, Anthropic, Gemini, DeepSeek, etc. If you configured an external provider, **excerpts of your conversations will be sent to that provider** as part of extraction. The primary conversation text is stored locally in SQLite at `~/.reflexio/` and is not sent to the provider directly, but the extracted summaries, trigger texts, and sample content are.\n\nIf you want a fully offline setup, point `~/.reflexio/.env` at a local LLM (Ollama, LM Studio, vLLM, etc.) before enabling the hook. If you haven't audited that configuration, assume extraction forwards sensitive content to a third-party API.\n\n**Localhost-only is a property of the hook, not the full system.** Earlier drafts of this documentation framed the integration as fully local. That framing was incomplete — it described the hook's network boundary correctly but ignored that the local Reflexio server then makes its own outbound LLM calls during extraction. The accurate statement is: the *hook* has no off-host destination, but the *server behind it* forwards excerpts to whichever LLM provider you configured.\n\nIf you want remote Reflexio (managed or self-hosted) from OpenClaw, this integration is not the one to use — it is deliberately crippled to localhost at the hook level. Use the Claude Code integration instead, which supports remote servers via `REFLEXIO_URL`.\n\n**What is captured (locally)**\n\n- Full message content — every user turn and every assistant turn in the session\n- Every tool call, its inputs, and its outputs — including **failed tool calls and the exact error strings**\n- Self-corrections written out loud mid-response (\"actually, this isn't quite right because…\") — these are preserved verbatim because they're the most valuable learning signal, but they also surface internal reasoning\n- User profile signals the local extraction pipeline infers from the conversation: expertise, working style, project conventions\n\nNone of this is scrubbed for PII, credentials, file paths, stack traces, or API outputs. Anything that appears in the conversation ends up in the local database. If you work on sensitive tasks, disable the hook before starting them, or tell the agent mid-task to stop logging.\n\n**How to disable**\n\n- **Per-session opt-out:** `openclaw hooks disable reflexio-context` — stops automatic capture immediately. Skill-driven search and publish commands still work until the agent stops calling them.\n- **Full uninstall:** `reflexio setup openclaw --uninstall` — removes the hook, slash commands, and workspace rule.\n- **Search-only mode** (keep retrieval, stop auto-capture): edit `hook/handler.js` to remove the `command:stop` event handler, then reinstall. The `message:received` injection continues working without buffering turns to the database.\n- **Wipe stored data:** delete `~/.reflexio/sessions.db` (buffered turns) and `~/.reflexio/` (full local store including extracted playbooks).\n- **Sensitive-task-only opt-out:** tell the agent at the start of the task. The workspace rule instructs it to honor the objection — skip search, skip capture, skip local server start — for the rest of the session.\n\n**Transparency expectations**\n\n- On the first turn of a session, the agent should briefly tell you that Reflexio is active and that it captures conversations into a local SQLite database on your machine. One or two sentences.\n- If the agent needs to start the local Reflexio server in the background, it should announce that before launching the process.\n- If you see a `REFLEXIO_CONTEXT.md` block in the agent's context, that's injected past-session memory driving the response. You can ask the agent to ignore it.\n\nThese expectations are enforced by the workspace rule at `~/.openclaw/workspace/reflexio.md`. If a deployment wants stricter silence or stricter disclosure, edit that file.\n\n---\n\n## Step-by-Step: When User Gives a Task\n\nFollow these steps IN ORDER:\n\n**Step 1 — Ensure the local Reflexio server is running:**\nThis integration always talks to the local Reflexio server at `127.0.0.1:8081`. Check that it's running:\n```bash\nreflexio status check\n```\nIf this fails with a connection error, tell the user you're starting the local Reflexio server in the background, then run:\n```bash\nnohup reflexio services start --only backend > ~/.reflexio/logs/server.log 2>&1 &\nsleep 5 && reflexio status check\n```\nThen continue to Step 2 immediately.\n\n**Step 2 — Search for relevant corrections:**\n```bash\nreflexio search \"<the user's request or task description>\"\n```\nUse the user's actual request as the query — not keywords. Different tasks return different playbooks. The server auto-scopes results to the current agent via OpenClaw's session key.\n\n**Step 3 — Apply results and do the task:**\n- If search returned playbooks → follow the content guidance in each playbook\n- If search returned profiles → adapt your approach to the user's preferences\n- If search returned nothing or failed → proceed normally\n\n---\n\n## Step-by-Step: When to Publish\n\n### Scenario 1: User Corrects You\n\nWhen the user corrects your approach or states a preference:\n\n**Step 1 — Apply the correction** to your work first.\n\n**Step 2 — Wait for enough context.** Don't publish immediately after the first correction message. Continue working until the correction is fully resolved and you have enough context to write a rich summary:\n- The original request\n- Your initial approach (including any self-corrections you wrote out loud)\n- The user's correction (their exact words)\n- Your corrected approach and outcome\n\n**Step 3 — Build a JSON summary and publish:**\n\n```bash\ncat > /tmp/reflexio-summary.json << 'SUMMARY_EOF'\n{\n  \"user_id\": \"<your-agent-id>\",\n  \"agent_version\": \"openclaw-agent\",\n  \"source\": \"openclaw\",\n  \"interactions\": [\n    {\"role\": \"user\", \"content\": \"<original request>\"},\n    {\n      \"role\": \"assistant\",\n      \"content\": \"<initial approach — preserve any self-correction text verbatim, e.g. 'this isn't quite right because...'>\",\n      \"tools_used\": [\n        {\"tool_name\": \"<tool>\", \"tool_data\": {\"input\": \"<params> — FAILED: <exact error>\"}}\n      ]\n    },\n    {\"role\": \"user\", \"content\": \"<user's correction — preserve their exact words>\"},\n    {\"role\": \"assistant\", \"content\": \"<corrected approach and outcome>\"}\n  ]\n}\nSUMMARY_EOF\nreflexio publish --agent-version openclaw-agent --source openclaw --skip-aggregation --force-extraction --file /tmp/reflexio-summary.json && rm -f /tmp/reflexio-summary.json\n```\n\n`tools_used` is **required** whenever the original approach involved a failed or rejected tool call — the error string is the evidence Reflexio needs to extract a precise behavioral rule. For pure-text corrections, the field can be omitted.\n\n**Detect correction patterns:**\n\n_Verbal corrections:_\n- \"No, use X instead of Y\"\n- \"Don't do X, always do Y\"\n- \"I prefer X\", \"Always use X in this project\"\n- \"That's wrong, the correct approach is...\"\n\n_Non-verbal / implicit corrections (also publish these):_\n- **Tool-call rejection** — user rejected a tool use mid-response. Record it in `tools_used` with `— REJECTED BY USER` and write `[rejected tool use — see tools_used above]` in the following user turn's `content`.\n- **Self-correction written out loud** — you realized mid-response you were doing the wrong thing and said so. Preserve the self-correction sentence verbatim in the assistant turn's `content`.\n- **Repeated tool failure with user intervention** — you failed the same operation 2+ times and the user redirected. List every failed attempt under `tools_used` on the original assistant turn.\n\n**Key principle:** Wait for sufficient context before publishing. A simple one-line correction (\"always use type hints\") can be published immediately. A multi-turn correction (user corrects, explains why, adds exceptions) should be published once the full chain is resolved.\n\n### Scenario 2: After Completing a Key Step\n\nAfter completing a meaningful milestone — a key step, sub-task, or the full task — reflect on what you learned and publish:\n\n- Non-obvious discoveries about this project or environment\n- Dead ends and tool quirks encountered\n- User preferences revealed through the work\n- Patterns that would help future sessions\n\nDon't wait until the entire task is done — publish at natural milestones. Build the same JSON summary format as above and publish with the same command.\n\n---\n\n## Multi-User and Agent Playbooks\n\nEach OpenClaw agent instance is a unique Reflexio user, identified by its `agentId`. This means:\n\n- **User playbooks** — corrections specific to this agent instance's interactions\n- **Agent playbooks** — shared corrections aggregated from ALL instances of this agent\n\n`reflexio search` returns both user playbooks (instance-specific) and agent playbooks (shared across all instances) — so every agent instance benefits from the collective learning.\n\nThe `user_id` field in publish payloads is auto-derived from OpenClaw's session key (the `agentId` prefix). You don't need to set it manually.\n\n---\n\n## What Reflexio Stores\n\n**User Profiles** — stable facts learned from conversations:\n- Expertise, background, role\n- Communication style and preferences\n- Technology stack and project conventions\n\n**User Playbooks** — per-instance behavioral corrections:\n- **trigger**: when does this rule apply?\n- **content**: the actionable behavioral rule\n- **rationale**: why the correction matters\n- **blocking_issue**: what prevents correct behavior (if applicable)\n\n**Agent Playbooks** — shared corrections aggregated from all instances:\n- Same structure as user playbooks\n- Produced by `reflexio agent-playbooks aggregate`\n- Returned alongside user playbooks in every `reflexio search`\n\nThe Reflexio server LLM analyzes your published summary and determines what gets extracted — you don't decide the structure.\n\n---\n\n## Server Management\n\nThis integration always talks to the local Reflexio server at `http://127.0.0.1:8081`. There is no remote-server mode — the hook is hard-pinned to loopback at the code level.\n\n- **Check:** `reflexio status check`\n- **Start (background):** `nohup reflexio services start --only backend > ~/.reflexio/logs/server.log 2>&1 &`\n- **Before starting it, tell the user briefly.** One sentence is enough: \"Starting the local Reflexio server in the background so I can fetch your past-session memory.\" Do not launch processes on the user's machine without telling them first.\n- If the user objects, skip the server start and proceed without Reflexio for this session.\n- If `reflexio` is not found, ask the user to install it: `pipx install reflexio-ai` (or `pip install --user reflexio-ai`)\n\n---\n\n## Command Reference\n\n| Command | Purpose | When |\n|---------|---------|------|\n| `reflexio search \"<task>\"` | Task-specific playbooks | Before every task |\n| `reflexio user-profiles search \"<query>\"` | User preferences | When personalizing |\n| `reflexio publish --force-extraction --file ...` | Publish corrections/learnings | After corrections or key steps |\n| `reflexio agent-playbooks aggregate` | Consolidate across instances | After corrections, or on schedule |\n| `reflexio agent-playbooks list` | View shared playbooks | Debugging, review |\n| `reflexio status check` | Check server | First use, or if commands fail |\n| `/reflexio-extract` | Comprehensive extraction | High-signal sessions |\n| `/reflexio-aggregate` | Manual aggregation | Consolidate learnings |\n\n---\n\n## Tips\n\n- **Use the user's actual request as the search query** — not keywords\n- **Preserve the user's exact words** in correction summaries\n- **Include evidence** — tool failures, error messages, self-correction sentences. Without evidence, Reflexio extracts vague profile entries; with evidence, it extracts precise playbook rules\n- **If Reflexio is unreachable, proceed normally** — it enhances but never blocks\n- **Tell the user Reflexio is active at session start** (see Privacy & Data Collection above). Cross-session logging is not something to leave implicit.\n- **Honor sensitive-task objections** — if the user says \"don't log this,\" stop all Reflexio calls (search, publish, server start) for the rest of the session\n- **Suggest `/reflexio-extract`** if a session had many corrections or learnings\n\nFile v1.0.9:skill/SKILL.md\n\n---\nname: reflexio\ndescription: \"Self-improving OpenClaw agents via Reflexio cross-session memory: the agent learns from every correction, tool failure, and stated preference so it stops repeating the same mistakes. Searches past playbooks before each task, captures new learnings after — and cross-instance aggregation turns one agent's correction into shared knowledge for every other agent. The hook is hard-pinned to a local Reflexio server at 127.0.0.1:8081 (no remote endpoints). That local server performs LLM-based extraction using whatever provider you configure in ~/.reflexio/.env, so extracted summaries may reach third-party APIs — see Privacy section before enabling.\"\n---\n\n# Reflexio: Learn from Past Sessions\n\nReflexio remembers corrections and preferences from past conversations with this user. Use it to retrieve task-specific guidance before working, and to record new learnings as you go.\n\n**This skill triggers on TWO types of messages:**\n1. **Task requests** — user asks you to do something → search Reflexio first\n2. **Corrections, preferences, and completed steps** → publish to Reflexio\n\nThe user can also run `/reflexio-extract` for comprehensive extraction of all session learnings, or `/reflexio-aggregate` to consolidate learnings across all agent instances.\n\n---\n\n## Privacy & Data Collection\n\n**Read this before enabling the skill.** Reflexio causes the agent to automatically capture conversations and forward them to a local Reflexio server for extraction and storage. Treat the following as material privacy information, not incidental detail.\n\n### Credential requirement (not declared in skill metadata — important)\n\nThe skill itself declares no required environment variables and the hook reads none. **But the end-to-end system does require an LLM provider API key**, and you will be asked for one during First-Use Setup:\n\n- `reflexio setup openclaw` runs an interactive wizard that prompts you to choose an LLM provider (OpenAI, Anthropic, Gemini, DeepSeek, OpenRouter, MiniMax, DashScope, xAI, Moonshot, ZAI, or any local provider via LiteLLM) and paste an API key.\n- The key is written to `~/.reflexio/.env`. The local Reflexio server reads it when extracting playbooks and profiles from captured conversations.\n- **The hook itself never reads this key or sees the contents of `~/.reflexio/.env`.** That's a property of the hook code, which has no filesystem config reads and no environment variable access at all. But the *server* the hook POSTs to does read the key, so from a \"what credentials will I end up providing to make this work\" perspective, treat the LLM provider key as a required dependency of the skill.\n- **If you want fully offline operation, point the wizard at a local LLM** (Ollama at `http://127.0.0.1:11434`, LM Studio, vLLM, etc.) instead of a hosted provider. The wizard accepts any LiteLLM-compatible base URL.\n\nThis credential is not declared in the skill's registry metadata because metadata-level `requires.env` only applies to the hook's own runtime reads, and the hook is deliberately stateless. But you should know it's coming before you install.\n\n### Two distinct network hops — know the difference\n\n1. **The hook → the local Reflexio server (always localhost).**\n   The hook is hard-pinned to `http://127.0.0.1:8081`. It communicates via native `fetch()` with no configuration knobs; the destination is a hardcoded constant in `handler.js`. It reads no environment variables and no dotfiles. This hop cannot leave your machine.\n\n2. **The local Reflexio server → an LLM provider (may leave your machine).**\n   The server uses an LLM provider (configured via `~/.reflexio/.env`) to extract playbooks and profiles from captured conversations. That provider is whichever one you set — OpenAI, Anthropic, Gemini, DeepSeek, etc. If you configured an external provider, **excerpts of your conversations will be sent to that provider** as part of extraction. The primary conversation text is stored locally in SQLite at `~/.reflexio/` and is not sent to the provider directly, but the extracted summaries, trigger texts, and sample content are.\n\nIf you want a fully offline setup, point `~/.reflexio/.env` at a local LLM (Ollama, LM Studio, vLLM, etc.) before enabling the hook. If you haven't audited that configuration, assume extraction forwards sensitive content to a third-party API.\n\n**Localhost-only is a property of the hook, not the full system.** Earlier drafts of this documentation framed the integration as fully local. That framing was incomplete — it described the hook's network boundary correctly but ignored that the local Reflexio server then makes its own outbound LLM calls during extraction. The accurate statement is: the *hook* has no off-host destination, but the *server behind it* forwards excerpts to whichever LLM provider you configured.\n\nIf you want remote Reflexio (managed or self-hosted) from OpenClaw, this integration is not the one to use — it is deliberately crippled to localhost at the hook level. Use the Claude Code integration instead, which supports remote servers via `REFLEXIO_URL`.\n\n**What is captured (locally)**\n\n- Full message content — every user turn and every assistant turn in the session\n- Every tool call, its inputs, and its outputs — including **failed tool calls and the exact error strings**\n- Self-corrections written out loud mid-response (\"actually, this isn't quite right because…\") — these are preserved verbatim because they're the most valuable learning signal, but they also surface internal reasoning\n- User profile signals the local extraction pipeline infers from the conversation: expertise, working style, project conventions\n\nNone of this is scrubbed for PII, credentials, file paths, stack traces, or API outputs. Anything that appears in the conversation ends up in the local database. If you work on sensitive tasks, disable the hook before starting them, or tell the agent mid-task to stop logging.\n\n**How to disable**\n\n- **Per-session opt-out:** `openclaw hooks disable reflexio-context` — stops automatic capture immediately. Skill-driven search and publish commands still work until the agent stops calling them.\n- **Full uninstall:** `reflexio setup openclaw --uninstall` — removes the hook, slash commands, and workspace rule.\n- **Search-only mode** (keep retrieval, stop auto-capture): edit `hook/handler.js` to remove the `command:stop` event handler, then reinstall. The `message:received` injection continues working without buffering turns to the database.\n- **Wipe stored data:** delete `~/.reflexio/sessions.db` (buffered turns) and `~/.reflexio/` (full local store including extracted playbooks).\n- **Sensitive-task-only opt-out:** tell the agent at the start of the task. The workspace rule instructs it to honor the objection — skip search, skip capture, skip local server start — for the rest of the session.\n\n**Transparency expectations**\n\n- On the first turn of a session, the agent should briefly tell you that Reflexio is active and that it captures conversations into a local SQLite database on your machine. One or two sentences.\n- If the agent needs to start the local Reflexio server in the background, it should announce that before launching the process.\n- If you see a `REFLEXIO_CONTEXT.md` block in the agent's context, that's injected past-session memory driving the response. You can ask the agent to ignore it.\n\nThese expectations are enforced by the workspace rule at `~/.openclaw/workspace/reflexio.md`. If a deployment wants stricter silence or stricter disclosure, edit that file.\n\n---\n\n## Step-by-Step: When User Gives a Task\n\nFollow these steps IN ORDER:\n\n**Step 1 — Ensure the local Reflexio server is running:**\nThis integration always talks to the local Reflexio server at `127.0.0.1:8081`. Check that it's running:\n```bash\nreflexio status check\n```\nIf this fails with a connection error, tell the user you're starting the local Reflexio server in the background, then run:\n```bash\nnohup reflexio services start --only backend > ~/.reflexio/logs/server.log 2>&1 &\nsleep 5 && reflexio status check\n```\nThen continue to Step 2 immediately.\n\n**Step 2 — Search for relevant corrections:**\n```bash\nreflexio search \"<the user's request or task description>\"\n```\nUse the user's actual request as the query — not keywords. Different tasks return different playbooks. The server auto-scopes results to the current agent via OpenClaw's session key.\n\n**Step 3 — Apply results and do the task:**\n- If search returned playbooks → follow the content guidance in each playbook\n- If search returned profiles → adapt your approach to the user's preferences\n- If search returned nothing or failed → proceed normally\n\n---\n\n## Step-by-Step: When to Publish\n\n### Scenario 1: User Corrects You\n\nWhen the user corrects your approach or states a preference:\n\n**Step 1 — Apply the correction** to your work first.\n\n**Step 2 — Wait for enough context.** Don't publish immediately after the first correction message. Continue working until the correction is fully resolved and you have enough context to write a rich summary:\n- The original request\n- Your initial approach (including any self-corrections you wrote out loud)\n- The user's correction (their exact words)\n- Your corrected approach and outcome\n\n**Step 3 — Build a JSON summary and publish:**\n\n```bash\ncat > /tmp/reflexio-summary.json << 'SUMMARY_EOF'\n{\n  \"user_id\": \"<your-agent-id>\",\n  \"agent_version\": \"openclaw-agent\",\n  \"source\": \"openclaw\",\n  \"interactions\": [\n    {\"role\": \"user\", \"content\": \"<original request>\"},\n    {\n      \"role\": \"assistant\",\n      \"content\": \"<initial approach — preserve any self-correction text verbatim, e.g. 'this isn't quite right because...'>\",\n      \"tools_used\": [\n        {\"tool_name\": \"<tool>\", \"tool_data\": {\"input\": \"<params> — FAILED: <exact error>\"}}\n      ]\n    },\n    {\"role\": \"user\", \"content\": \"<user's correction — preserve their exact words>\"},\n    {\"role\": \"assistant\", \"content\": \"<corrected approach and outcome>\"}\n  ]\n}\nSUMMARY_EOF\nreflexio publish --agent-version openclaw-agent --source openclaw --skip-aggregation --force-extraction --file /tmp/reflexio-summary.json && rm -f /tmp/reflexio-summary.json\n```\n\n`tools_used` is **required** whenever the original approach involved a failed or rejected tool call — the error string is the evidence Reflexio needs to extract a precise behavioral rule. For pure-text corrections, the field can be omitted.\n\n**Detect correction patterns:**\n\n_Verbal corrections:_\n- \"No, use X instead of Y\"\n- \"Don't do X, always do Y\"\n- \"I prefer X\", \"Always use X in this project\"\n- \"That's wrong, the correct approach is...\"\n\n_Non-verbal / implicit corrections (also publish these):_\n- **Tool-call rejection** — user rejected a tool use mid-response. Record it in `tools_used` with `— REJECTED BY USER` and write `[rejected tool use — see tools_used above]` in the following user turn's `content`.\n- **Self-correction written out loud** — you realized mid-response you were doing the wrong thing and said so. Preserve the self-correction sentence verbatim in the assistant turn's `content`.\n- **Repeated tool failure with user intervention** — you failed the same operation 2+ times and the user redirected. List every failed attempt under `tools_used` on the original assistant turn.\n\n**Key principle:** Wait for sufficient context before publishing. A simple one-line correction (\"always use type hints\") can be published immediately. A multi-turn correction (user corrects, explains why, adds exceptions) should be published once the full chain is resolved.\n\n### Scenario 2: After Completing a Key Step\n\nAfter completing a meaningful milestone — a key step, sub-task, or the full task — reflect on what you learned and publish:\n\n- Non-obvious discoveries about this project or environment\n- Dead ends and tool quirks encountered\n- User preferences revealed through the work\n- Patterns that would help future sessions\n\nDon't wait until the entire task is done — publish at natural milestones. Build the same JSON summary format as above and publish with the same command.\n\n---\n\n## Multi-User and Agent Playbooks\n\nEach OpenClaw agent instance is a unique Reflexio user, identified by its `agentId`. This means:\n\n- **User playbooks** — corrections specific to this agent instance's interactions\n- **Agent playbooks** — shared corrections aggregated from ALL instances of this agent\n\n`reflexio search` returns both user playbooks (instance-specific) and agent playbooks (shared across all instances) — so every agent instance benefits from the collective learning.\n\nThe `user_id` field in publish payloads is auto-derived from OpenClaw's session key (the `agentId` prefix). You don't need to set it manually.\n\n---\n\n## What Reflexio Stores\n\n**User Profiles** — stable facts learned from conversations:\n- Expertise, background, role\n- Communication style and preferences\n- Technology stack and project conventions\n\n**User Playbooks** — per-instance behavioral corrections:\n- **trigger**: when does this rule apply?\n- **content**: the actionable behavioral rule\n- **rationale**: why the correction matters\n- **blocking_issue**: what prevents correct behavior (if applicable)\n\n**Agent Playbooks** — shared corrections aggregated from all instances:\n- Same structure as user playbooks\n- Produced by `reflexio agent-playbooks aggregate`\n- Returned alongside user playbooks in every `reflexio search`\n\nThe Reflexio server LLM analyzes your published summary and determines what gets extracted — you don't decide the structure.\n\n---\n\n## Server Management\n\nThis integration always talks to the local Reflexio server at `http://127.0.0.1:8081`. There is no remote-server mode — the hook is hard-pinned to loopback at the code level.\n\n- **Check:** `reflexio status check`\n- **Start (background):** `nohup reflexio services start --only backend > ~/.reflexio/logs/server.log 2>&1 &`\n- **Before starting it, tell the user briefly.** One sentence is enough: \"Starting the local Reflexio server in the background so I can fetch your past-session memory.\" Do not launch processes on the user's machine without telling them first.\n- If the user objects, skip the server start and proceed without Reflexio for this session.\n- If `reflexio` is not found, ask the user to install it: `pipx install reflexio-ai` (or `pip install --user reflexio-ai`)\n\n---\n\n## Command Reference\n\n| Command | Purpose | When |\n|---------|---------|------|\n| `reflexio search \"<task>\"` | Task-specific playbooks | Before every task |\n| `reflexio user-profiles search \"<query>\"` | User preferences | When personalizing |\n| `reflexio publish --force-extraction --file ...` | Publish corrections/learnings | After corrections or key steps |\n| `reflexio agent-playbooks aggregate` | Consolidate across instances | After corrections, or on schedule |\n| `reflexio agent-playbooks list` | View shared playbooks | Debugging, review |\n| `reflexio status check` | Check server | First use, or if commands fail |\n| `/reflexio-extract` | Comprehensive extraction | High-signal sessions |\n| `/reflexio-aggregate` | Manual aggregation | Consolidate learnings |\n\n---\n\n## Tips\n\n- **Use the user's actual request as the search query** — not keywords\n- **Preserve the user's exact words** in correction summaries\n- **Include evidence** — tool failures, error messages, self-correction sentences. Without evidence, Reflexio extracts vague profile entries; with evidence, it extracts precise playbook rules\n- **If Reflexio is unreachable, proceed normally** — it enhances but never blocks\n- **Tell the user Reflexio is active at session start** (see Privacy & Data Collection above). Cross-session logging is not something to leave implicit.\n- **Honor sensitive-task objections** — if the user says \"don't log this,\" stop all Reflexio calls (search, publish, server start) for the rest of the session\n- **Suggest `/reflexio-extract`** if a session had many corrections or learnings\n\nFile v1.0.9:README.md\n\n# Reflexio OpenClaw Integration\n\nConnect [OpenClaw](https://openclaw.ai) agents to [Reflexio](https://github.com/reflexio-ai/reflexio) for automatic self-improvement with multi-user support and agent playbooks. Conversations are captured automatically; task-specific playbooks are retrieved on-demand via the `reflexio` CLI; and corrections from multiple agent instances are aggregated into shared agent playbooks.\n\n## Table of Contents\n\n- [How It Works](#how-it-works)\n- [Multi-User Architecture](#multi-user-architecture)\n- [Agent Playbooks](#agent-playbooks)\n- [Prerequisites](#prerequisites)\n- [Installation](#installation)\n- [Configuration](#configuration)\n- [Scheduled Aggregation](#scheduled-aggregation)\n- [What to Expect](#what-to-expect)\n- [File Structure](#file-structure)\n- [Manual Testing](#manual-testing)\n- [Comparison with Claude Code / LangChain Integrations](#comparison-with-claude-code--langchain-integrations)\n\n## How It Works\n\n```mermaid\nflowchart TD\n    subgraph \"1. Capture (Hook)\"\n        C1[\"Each turn: buffer messages\"] --> C2[\"Session end: publish to Reflexio\"]\n        C2 --> C3[\"Server extracts playbooks & profiles\"]\n    end\n\n    subgraph \"2. Retrieve (Hook + Skill)\"\n        R1[\"message:received hook\"] --> R2[\"reflexio search\"]\n        R2 --> R3[\"Inject matching playbooks & profiles\"]\n        R4[\"Skill: on-demand search\"] --> R2\n    end\n\n    subgraph \"3. Aggregate (Automatic + Manual)\"\n        A1[\"Cluster similar user playbooks\"] --> A2[\"Deduplicate & consolidate\"]\n        A2 --> A3[\"Shared Agent Playbooks\"]\n        A4[\"Cron / manual trigger\"] --> A1\n    end\n\n    C3 --> R2\n    C3 --> A1\n    A3 --> R3\n```\n\n\n\nThe integration has three independent mechanisms:\n\n### 1. Capture (Hook — automatic, runs every session)\n\n```\nEach Turn (message:sent)\n  └── Buffer (user message, agent response) → local SQLite\n\nSession End (command:stop)\n  └── reflexio interactions publish → flush buffered turns to Reflexio server\n      └── Server automatically:\n          1. Detects learning signals (corrections, friction, re-steering)\n          2. Extracts playbooks: content + top-level fields (trigger, rationale, blocking_issue)\n          3. Extracts user profiles (preferences, expertise, communication style)\n          4. Stores everything with vector embeddings for semantic search\n\nMid-Session (skill guidance)\n  └── Skill guides agent to publish corrections and learnings at key steps\n      └── Captures high-signal moments without waiting for session end\n```\n\nCorrection detection happens **server-side via LLM** — the agent does not need to detect corrections itself.\n\n### 2. Retrieve (Hook + Skill — automatic + on-demand)\n\n```\nPer-message (message:received hook — automatic)\n  └── Hook injects reflexio search results before every agent response\n      └── Returns user playbooks + agent playbooks relevant to the current message\n\nPer-task (skill — on-demand)\n  └── Agent runs reflexio search \"<the user's actual task>\"\n      └── Semantic search matches query against playbook trigger fields\n      └── Returns only playbooks relevant to THIS specific task\n      └── Each result has content (primary actionable rule) + top-level fields (trigger, rationale, blocking_issue)\n\nAgent needs to personalize response\n  └── reflexio user-profiles search \"<what to know about the user>\"\n      └── Vector + FTS hybrid search on profile content\n      └── Returns relevant user preferences, expertise, communication style\n```\n\nBoth the hook injection and the per-task skill search return **user playbooks** (corrections specific to this agent instance) and **agent playbooks** (shared corrections aggregated from all instances).\n\nPlaybook retrieval is **per-task, not per-session**. Different tasks return different playbooks. The query is matched against the `trigger` field of stored playbooks using semantic search.\n\n### 3. Aggregate (Automatic + Manual)\n\n```\nAfter each successful publish\n  └── Aggregation runs in background automatically\n      └── Clusters similar user playbooks across all agent instances\n      └── Deduplicates and consolidates into shared agent playbooks\n      └── New agent playbooks start as PENDING → reviewed → APPROVED/REJECTED\n\nManual trigger\n  └── /reflexio-aggregate command  (OpenClaw slash command)\n  └── reflexio agent-playbooks aggregate  (CLI)\n\nScheduled (recommended for teams)\n  └── Cron job or systemd timer runs aggregation periodically\n```\n\nAgent playbooks accumulate corrections from all agent instances, so every instance benefits from corrections made by any other instance.\n\n## Multi-User Architecture\n\nEach OpenClaw agent (identified by its `agentId`) is treated as a distinct Reflexio user. This enables per-agent learning isolation alongside cross-agent shared learning:\n\n```\n~/.openclaw/\n├── agents/\n│   ├── main/        → Reflexio user_id: \"main\"\n│   ├── work/        → Reflexio user_id: \"work\"\n│   └── ops/         → Reflexio user_id: \"ops\"\n```\n\n- **User playbooks**: per-agent corrections, isolated by `agentId`. Mistakes made by `main` are tracked separately from mistakes made by `work`.\n- **Agent playbooks**: shared corrections aggregated from ALL agents. Once a correction is aggregated and approved, every instance sees it via `reflexio search`.\n- **`user_id`** is derived from the OpenClaw session key prefix (`agent:<id>:...`). There is no override — the hook is deliberately locked to sessionKey-derived identity to eliminate env-var reads.\n\n## Agent Playbooks\n\nAgent playbooks are the cross-instance knowledge layer. Individual corrections from each instance flow into a shared pool through aggregation:\n\n```\nInstance \"main\" corrections ─┐\nInstance \"work\" corrections ──┤── Aggregation ──→ Shared Agent Playbooks\nInstance \"ops\" corrections ───┘\n```\n\n- **Aggregation** clusters semantically similar user playbooks, deduplicates them, and consolidates them into a single agent playbook per distinct correction type.\n- **Approval status**: new agent playbooks start as `PENDING`. They are surfaced in search immediately but can be reviewed and marked `APPROVED` or `REJECTED`.\n- **All instances** receive agent playbooks alongside their own user playbooks via `reflexio search`.\n\nThis means a correction made once by any instance eventually prevents the same mistake across all instances.\n\n## Prerequisites\n\n- [OpenClaw](https://openclaw.ai) installed and running\n- The `reflexio` CLI on PATH: `pipx install reflexio-ai` (or `pip install --user reflexio-ai`)\n- The local Reflexio server running at `127.0.0.1:8081` (the hook starts it automatically if it's down)\n\n**The Reflexio server requires an LLM API key** (e.g., `OPENAI_API_KEY`) in `~/.reflexio/.env` for playbook extraction — that key is read by the server process, never by this hook. Supported providers: OpenAI, Anthropic, Google Gemini, DeepSeek, OpenRouter, MiniMax, DashScope, xAI, Moonshot, ZAI.\n\n> Run `reflexio setup openclaw` to automate LLM provider selection, storage configuration, and hook/skill/command installation.\n\n## Installation\n\n### Option 1 — ClawHub (recommended)\n\n```bash\nclawhub skill install reflexio\n```\n\nOn first use, the skill auto-installs the `reflexio-ai` CLI (via `pipx` or `pip`) and runs `reflexio setup openclaw` to activate the hook, slash commands, and workspace rule.\n\n### Option 2 — Automated setup (if you already have `reflexio-ai` installed)\n\n```bash\npip install reflexio-ai\nreflexio setup openclaw\n```\n\nThis installs the hook, copies the skill and commands to `~/.openclaw/skills/`, and drops the workspace rule into `~/.openclaw/workspace/`.\n\n### Option 3 — Manual (for developing against source)\n\n```bash\n# Hook: automatic capture + retrieval\nopenclaw hooks install /path/to/reflexio/integrations/openclaw/hook --link\nopenclaw hooks enable reflexio-context\nopenclaw gateway restart\nopenclaw hooks list  # expect: ✓ ready │ 🧠 reflexio-context\n\n# Skill: teaches agent when/how to use reflexio CLI\ncp -r /path/to/openclaw/skill ~/.openclaw/skills/reflexio\n\n# Commands: publish corrections mid-session, trigger aggregation\ncp -r /path/to/openclaw/commands/reflexio-extract ~/.openclaw/skills/reflexio-extract\ncp -r /path/to/openclaw/commands/reflexio-aggregate ~/.openclaw/skills/reflexio-aggregate\n\n# Rule: always-active behavioral constraints — loaded every session\ncp /path/to/openclaw/rules/reflexio.md ~/.openclaw/workspace/reflexio.md\n```\n\nThe rule ensures the agent follows injected Reflexio context, runs manual search fallback when the hook doesn't fire, and enforces behavioral conventions (transparency, non-blocking, silent infrastructure).\n\n## Configuration\n\nThis integration is **localhost-only**. The hook hard-codes the Reflexio\nserver URL to `http://127.0.0.1:8081` and reads no environment variables —\nit cannot be reconfigured to send data off-host. The agent label is hardcoded\nto `openclaw-agent` and the per-agent user ID is derived from OpenClaw's\nsession key (`agent:<id>:...` prefix), with a fallback of `openclaw`.\n\nIf you need remote Reflexio (managed or self-hosted) from OpenClaw, use the\nClaude Code integration instead — it supports a full set of env vars for\npointing at external servers.\n\n\n## Scheduled Aggregation\n\nFor teams running many agent instances, schedule periodic aggregation so agent playbooks stay up to date:\n\n```bash\n# Aggregate every 6 hours (crontab -e)\n0 */6 * * * reflexio agent-playbooks aggregate --agent-version openclaw-agent 2>> ~/.reflexio/logs/aggregation.log\n```\n\n**systemd timer** (Linux):\n\n```ini\n# ~/.config/systemd/user/reflexio-aggregate.service\n[Service]\nExecStart=reflexio agent-playbooks aggregate --agent-version openclaw-agent\n\n# ~/.config/systemd/user/reflexio-aggregate.timer\n[Timer]\nOnCalendar=*-*-* 00/6:00:00\nPersistent=true\n```\n\nIf OpenClaw supports scheduled tasks natively, you can also register aggregation as a recurring OpenClaw task to keep everything within the same scheduler.\n\n## What to Expect\n\n**Session 1 (cold start):** No playbooks exist yet. The agent works normally. At session end, the hook captures the full conversation. Reflexio's server-side LLM pipeline analyzes it and extracts any corrections or user preferences.\n\n**Session 2+:** Before each task, the agent runs `reflexio search \"<task>\"` and gets task-specific corrections from past sessions — both user playbooks (corrections from this agent instance) and agent playbooks (corrections shared across all instances). Over time:\n\n- Mistakes made once are not repeated (corrections match by trigger similarity)\n- User preferences are remembered (profiles extracted automatically)\n- The agent adapts its approach per-task based on accumulated playbooks\n- Corrections from one agent instance propagate to all instances via aggregation\n\n**The learning loop:**\n\n1. Agent works on a task → user corrects a mistake\n2. Session ends → hook captures full conversation → server extracts user playbooks\n3. Next session, similar task → agent searches → gets the correction → applies the behavioral guideline\n4. Mistake not repeated\n5. Aggregation runs → correction promotes to agent playbook → all other instances benefit too\n\n## File Structure\n\n```\nopenclaw/\n├── README.md               ← This file\n├── hook/                   ← Automatic: capture conversations + inject search results\n│   ├── handler.js          ← Event handlers: bootstrap, message:received, message:sent, command:stop\n│   ├── HOOK.md             ← Hook metadata (events, requirements)\n│   └── package.json        ← npm package manifest\n├── skill/                  ← On-demand: search for task-specific playbooks + publish\n│   └── SKILL.md            ← Teaches agent when/how to search, publish, and aggregate\n├── rules/                  ← Always-active: behavioral constraints loaded every session\n│   └── reflexio.md         ← Follow injected context, manual search fallback, transparency\n└── commands/               ← OpenClaw slash commands\n    ├── reflexio-extract/   ← /reflexio-extract: publish corrections mid-session\n    └── reflexio-aggregate/ ← /reflexio-aggregate: trigger aggregation manually\n```\n\n## Manual Testing\n\nSee [TESTING.md](TESTING.md) for a step-by-step guide to manually test the integration end-to-end — from install through search, capture, retrieval, multi-user isolation, graceful degradation, and uninstall.\n\n## Comparison with Claude Code / LangChain Integrations\n\n\n| Aspect               | OpenClaw                                       | Claude Code                                    | LangChain                               |\n| -------------------- | ---------------------------------------------- | ---------------------------------------------- | --------------------------------------- |\n| Integration method   | CLI commands + hooks                           | CLI commands + hooks                           | Python SDK + callbacks                  |\n| Context retrieval    | Per-message (hook) + per-task (skill)          | Per-task via skill                             | Per-LLM-call via middleware (automatic) |\n| Conversation capture | Hook buffers → SQLite → flushes at session end | Hook buffers → SQLite → flushes at session end | Callback captures per chain run         |\n| Multi-user support   | Yes — per-agentId user isolation               | Yes — per-agent user isolation                 | Single user per client instance         |\n| Agent playbooks      | Yes — aggregated across all instances          | Yes — aggregated across all instances          | Not yet                                 |\n| Agent teaching       | SKILL.md (natural language)                    | SKILL.md (natural language)                    | Tool definition (structured)            |\n| Dependencies         | `reflexio` CLI only                            | `reflexio` CLI only                            | `langchain-core >= 0.3.0`               |\n\n\nAll integrations connect to the same Reflexio server and share the same playbook/profile data. Agent playbooks aggregated from OpenClaw instances are visible to Claude Code agents, and vice versa, as long as they use the same `--agent-version` tag.\n\n## Further Reading\n\n- [Reflexio main README](../../../../README.md)\n- [Python SDK documentation](../../../client_dist/README.md)\n\nFile v1.0.9:_meta.json\n\n{\n  \"ownerId\": \"kn76hm02452z7faay8fxk5m65n84wnjm\",\n  \"slug\": \"reflexio\",\n  \"version\": \"1.0.9\",\n  \"publishedAt\": 1776839388380\n}\n\nFile v1.0.9:hook/HOOK.md\n\n---\nname: reflexio-context\ndescription: \"Inject user profile at session start, capture conversations at session end for automatic playbook and profile extraction\"\nmetadata:\n  openclaw:\n    emoji: \"brain\"\n    events: [\"agent:bootstrap\", \"message:received\", \"message:sent\", \"command:stop\"]\n    requires:\n      bins: [\"reflexio\"]\n      env: []\n---\n\n# Reflexio Context Hook\n\nAutomatically connects your OpenClaw agent to [Reflexio](https://github.com/reflexio-ai/reflexio) for continuous self-improvement.\n\n## What It Does\n\nThe hook is pure Node.js + native `fetch()`. It does not spawn subprocesses\nor invoke the `reflexio` CLI — all traffic is HTTP to the local Reflexio\nbackend at `http://127.0.0.1:8081`.\n\n### On `agent:bootstrap` (session start)\nPOSTs to `/api/search` with the query `\"communication style, expertise, and\npreferences\"` to fetch a brief user profile summary. Injects user preferences,\nexpertise, and communication style as a `REFLEXIO_USER_PROFILE.md` bootstrap\nfile. Does NOT load playbooks here — those are retrieved per-message or\nper-task.\n\n### On `message:received` (before each response)\nPOSTs to `/api/search` with the user's message and `top_k: 5`. If results are\nfound, formats them as markdown and injects a `REFLEXIO_CONTEXT.md` bootstrap\nfile with relevant playbooks and corrections. Skips trivial inputs (< 5\nchars, or `yes/no/ok/sure/thanks`). Times out after 5 seconds — never blocks\nthe response.\n\n### On `message:sent` (each turn)\nBuffers each (user message, agent response) pair into a local SQLite database\n(`~/.reflexio/sessions.db`). Lightweight local write — no network calls. If\nthe buffer exceeds `BATCH_SIZE * 2` unpublished turns, triggers an incremental\npublish (see below).\n\n### On `command:stop` (session end)\nPOSTs the complete buffered conversation to `/api/publish_interaction` as a\nsingle JSON request. The local Reflexio server detects corrections via LLM\nanalysis, extracts playbooks (content + top-level fields: trigger, rationale,\nblocking_issue) and user profiles. Blocks\nbriefly on the HTTP round-trip; if it fails, turns stay unpublished and are\nretried on the next `agent:bootstrap`.\n\n## Prerequisites\n\n1. **`reflexio` CLI on PATH** — `pipx install reflexio-ai` (or `pip install --user reflexio-ai`). Needed to start the backend server and run the slash commands.\n2. **Local Reflexio server running at `http://127.0.0.1:8081`** — the hook does NOT start it; the skill's First-Use Setup does that once via `reflexio services start --only backend`.\n3. **An LLM provider API key in `~/.reflexio/.env`** — **required for the system to work end-to-end, even though the hook itself never reads it.** The local Reflexio server uses this key to extract playbooks and profiles from captured conversations via LiteLLM. `reflexio setup openclaw` will prompt you interactively for the provider (OpenAI, Anthropic, Gemini, DeepSeek, OpenRouter, MiniMax, DashScope, xAI, Moonshot, ZAI, or any local LLM via a custom base URL) and write the key for you. **If you want fully offline operation, provide a local LLM endpoint (Ollama, LM Studio, vLLM) at this step instead of a hosted provider.**\n\nThe skill's registry metadata does not declare this LLM key under `requires.env` because that field describes variables the hook's own code path reads, and the hook is deliberately stateless (no env var access, no filesystem config reads — enforced in `handler.js`). The dependency lives one hop away, at the backend server, and is called out here in prose instead.\n\n## Privacy: what the hook guarantees, what it doesn't\n\nThe hook itself communicates only with `http://127.0.0.1:8081`. It reads no\nenvironment variables, no configuration files, and has no code path that\nreaches any other host.\n\n**The local Reflexio server, however, makes outbound LLM API calls** for\nprofile/playbook extraction. The destination is whatever you configured in\n`~/.reflexio/.env` (OpenAI, Anthropic, Gemini, etc.). If that provider is\nexternal, excerpts of your conversations will be sent to it. If you want a\nfully offline setup, configure the server to use a local LLM (Ollama,\nLM Studio, vLLM, etc.) before enabling the hook.\n\n## Security contract — hook side\n\nThis hook is **hard-pinned to `http://127.0.0.1:8081`**. The destination is a\nhardcoded constant in `handler.js`; changing it requires editing the source.\nThe hook reads **no environment variables** and **no configuration files**.\nAll settings are hardcoded at module scope in `handler.js`:\n\n- Server URL: `http://127.0.0.1:8081` (loopback, not configurable)\n- Agent label: `openclaw-agent` (not configurable)\n- User ID: derived from OpenClaw's session key prefix, with fallback `openclaw`\n\nIf you need remote Reflexio from OpenClaw, run a local proxy at\n`127.0.0.1:8081` or use the Claude Code integration, which supports a full\nset of configuration overrides for remote endpoints.\n\nFile v1.0.9:rules/reflexio.md\n\n# Reflexio: Cross-Session Memory\n\nThis agent uses Reflexio to remember corrections and preferences across sessions. **Reflexio captures full conversations (user messages, assistant responses, tool calls and errors, self-corrections) and forwards them to a local Reflexio server at `127.0.0.1:8081` for LLM-based extraction.** The hook is hard-pinned to localhost — it cannot reach any other host. **However**, the local server itself uses an LLM provider (configured in `~/.reflexio/.env`) to extract playbooks and profiles, and if that provider is external (OpenAI, Anthropic, etc.) then excerpts of the conversation will be sent to it as part of extraction. See the Privacy & Data Collection section in the skill for the full two-hop disclosure.\n\n## How It Works\n\nA `message:received` hook automatically runs `reflexio search` on every message you receive. When relevant corrections or preferences exist, they are injected as context before your response via a file named `REFLEXIO_CONTEXT.md`.\n\n## What You MUST Do\n\n1. **When you see a block titled \"REFLEXIO_CONTEXT\"** — read it carefully and follow every instruction it contains. These are explicit corrections from the user's past sessions. Behavior Corrections tell you what to do differently. User Preferences tell you how the user works. Agent Playbooks are shared corrections from all instances.\n\n2. **Be transparent about Reflexio.** On the first turn of each session, briefly tell the user: (a) Reflexio cross-session memory is active, (b) it captures messages, tool calls, errors, and self-corrections, (c) it talks only to a local Reflexio server at `127.0.0.1:8081`, BUT (d) that server uses an LLM provider configured in `~/.reflexio/.env` (OpenAI, Anthropic, Gemini, local Ollama, etc.) to extract playbooks — so conversation excerpts may reach whichever provider the user picked during install. Keep it to two or three sentences. If the user asks to disable it, point them to `openclaw hooks disable reflexio-context` or `reflexio setup openclaw --uninstall`, and stop using Reflexio for the rest of the session.\n\n   Also: if the user says they don't remember which provider they configured, suggest they run `cat ~/.reflexio/.env | grep -i key` to check. If the provider is a hosted API (OpenAI, Anthropic, etc.), recommend treating the current session as if the LLM provider will see excerpts. If it's a localhost endpoint (Ollama, LM Studio), the full pipeline is offline.\n\n3. **If no Reflexio context appears for a task** — the hook may not have found relevant results, or the local server may be starting up. Run a manual search before beginning work:\n   ```\n   reflexio search \"<the user's task or request>\"\n   ```\n   If the command fails with a connection error, **tell the user you're starting the local Reflexio server in the background** before running:\n   ```bash\n   nohup reflexio services start --only backend > ~/.reflexio/logs/server.log 2>&1 &\n   ```\n\n4. **If Reflexio is unavailable, proceed normally** — it enhances but never blocks your work. Never degrade the core agent experience because of Reflexio issues.\n\n5. **Respect user objections.** If the user says they don't want their conversation logged, or that they're working on a sensitive task, stop all Reflexio calls for the remainder of the session. Do not launch the local server, do not run `reflexio publish`, and do not run `reflexio search`. Offer to disable the hook entirely if they'd like a permanent opt-out.\n\nFile v1.0.9:hook/package.json\n\n{\n  \"name\": \"openclaw-hook-reflexio-context\",\n  \"version\": \"2.0.0\",\n  \"description\": \"OpenClaw hook for Reflexio: injects context at session start, captures full conversations at session end for automatic feedback and profile extraction\",\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/reflexio-ai/reflexio\"\n  },\n  \"dependencies\": {\n    \"better-sqlite3\": \"^11.0.0\"\n  },\n  \"openclaw\": {\n    \"hooks\": [\".\"]\n  },\n  \"files\": [\n    \"handler.js\",\n    \"HOOK.md\"\n  ]\n}\n\nArchive v1.0.8: 30 files, 52131 bytes\n\nFiles: _meta.json (127b), agents/reflexio-consolidator.md (2098b), agents/reflexio-extractor.md (2337b), assets/playbook_template.md (372b), assets/profile_template.md (276b), commands/reflexio-consolidate/SKILL.md (1810b), config.json (250b), hook/handler.ts (8832b), hook/HOOK.md (610b), hook/smoke-test.ts (4617b), index.ts (3529b), openclaw.plugin.json (1161b), package.json (378b), prompts/full_consolidation.md (2009b), prompts/playbook_extraction.md (14194b), prompts/profile_extraction.md (7832b), prompts/README.md (1230b), prompts/shallow_dedup_pairwise.md (1742b), README.md (6879b), references/architecture.md (3024b), references/comparison.md (1881b), references/future-work.md (2993b), references/porting-notes.md (3532b), scripts/install.sh (5862b), scripts/reflexio-write.sh (6945b), scripts/uninstall.sh (1958b), SECURITY.md (5871b), SKILL.md (17415b), tsconfig.json (296b), types/openclaw.d.ts (4537b)\n\nFile v1.0.8:commands/reflexio-consolidate/SKILL.md\n\n---\nname: reflexio-consolidate\ndescription: \"Run a full-sweep consolidation over all .reflexio/ files — TTL sweep + n-way cluster merge. Use when the user asks to 'clean up reflexio', 'consolidate memory', 'deduplicate playbooks', or suspects drift across sessions.\"\n---\n\n# Reflexio Consolidate\n\nUser-invocable via `/skill reflexio-consolidate`. Same workflow that runs daily at 3am via the plugin's cron job, but on-demand.\n\n## What it does\n\n1. TTL sweep: delete expired profile files.\n2. For each of profiles and playbooks:\n   - Cluster similar files via `memory_search`.\n   - For clusters of 2+ members, call `llm-task` with `prompts/full_consolidation.md` to decide merge / subset / keep-all.\n   - Apply decisions: write merged files with `supersedes:` frontmatter, unlink merged originals.\n\n## How to run\n\nDelegate to the `reflexio-consolidator` sub-agent:\n\n```\nsessions_spawn(\n  task: \"Run your full-sweep consolidation workflow now. Follow your system prompt in full.\",\n  agentId: \"reflexio-consolidator\",\n  runTimeoutSeconds: 300,\n  mode: \"run\",\n)\n```\n\nReport the returned `runId` to the user. They can inspect progress via `openclaw tasks list`.\n\n## When to use\n\n- User asks to \"consolidate\", \"clean up reflexio\", \"dedupe memory\"\n- User reports seeing duplicate or contradictory entries in retrieval\n- After a long period without daily cron runs (e.g. host was offline)\n\n## When NOT to use\n\n- Routine maintenance — the daily cron at 3am handles this.\n- Immediately after Flow A/B writes — shallow dedup at write time + Flow C at session end cover the fresh-extraction cases.\n\n## Failure modes\n\nIf `sessions_spawn` is unavailable or `reflexio-consolidator` agent is not registered, the plugin's install.sh did not complete. Tell the user to re-run `./scripts/install.sh` in the plugin directory.\n\nFile v1.0.8:SKILL.md\n\n---\nname: reflexio-embedded\ndescription: \"Captures user facts and procedural corrections into .reflexio/ so the agent learns across sessions. Use when: (1) user states a preference, fact, config, or constraint; (2) user corrects the agent and confirms the fix with an explicit 'good'/'perfect' or by moving on without re-correcting for 1-2 turns; (3) at start of a user turn, to retrieve relevant facts and playbooks from past sessions.\"\nmetadata:\n  openclaw:\n    homepage: https://github.com/reflexio-ai/reflexio/tree/main/reflexio/integrations/openclaw-embedded\n    emoji: 🧠\n    requires:\n      bins: [openclaw, node, bash]\n      plugins: [active-memory]\n    writes:\n      - \".reflexio/ (workspace-local: captured profiles and playbooks)\"\n      - \"~/.openclaw/workspace/skills/reflexio-embedded/ (skill + consolidate command)\"\n      - \"~/.openclaw/workspace/agents/reflexio-extractor.md\"\n      - \"~/.openclaw/workspace/agents/reflexio-consolidator.md\"\n      - \"~/.openclaw/workspace/plugins/reflexio-embedded/ (prompts + helper scripts)\"\n    sideEffects:\n      - \"Enables the active-memory plugin host-wide\"\n      - \"Registers a daily 3am cron (reflexio-embedded-consolidate)\"\n      - \"Restarts the Openclaw gateway on install\"\n      - \"Spawns reflexio-extractor sub-agent on session:compact:before / command:stop / command:reset\"\n---\n\n## Privacy, Credentials & Persistence — Read This First\n\nThis plugin runs entirely inside Openclaw — **there is no Reflexio server, no\nseparate backend process, and no dedicated API key owned by this plugin.**\nHowever, the install script makes several privileged changes to your Openclaw\ninstall, and the runtime captures conversation content that is not scrubbed.\nRead this before enabling.\n\n### Credentials\n\n**This plugin declares no required env vars and owns no credentials.** It\ndoes not prompt for or store any API key. This is a deliberate design\ndifference from the server-backed `reflexio` skill.\n\n**But extraction still needs an LLM**, and it uses whichever model your\nOpenclaw gateway is already configured with:\n\n- Flow C session-end extraction (sub-agent reads full transcript)\n- Daily 3am consolidation cron (sub-agent runs n-way cluster merge)\n- Embedding calls for memory search (if an embedding provider is configured\n  in Openclaw)\n\nIf Openclaw is configured to use a hosted provider (OpenAI, Anthropic, Gemini,\netc.), **excerpts of your conversations and extracted summaries will traverse\nthat provider's network path.** If you need fully offline operation,\nconfigure a local LLM (Ollama, LM Studio, vLLM) in Openclaw before installing\nthis plugin. The plugin itself adds no new outbound hop — all network traffic\ngoes through Openclaw's existing LLM config.\n\n### What is captured, verbatim\n\nThe session-end extractor sub-agent and the daily consolidator read the full\ntranscript **un-scrubbed**. That includes:\n\n- Full user and assistant messages\n- Tool inputs, outputs, and error strings (including failures)\n- Self-correction text from the assistant\n- Anything pasted into the conversation\n\nThe in-session agent instructions say to redact secrets before writing to\n`.reflexio/`, but the sub-agents operate on the raw transcript. If you are\nabout to paste credentials, tokens, private keys, PII, or otherwise sensitive\ncontent, **disable the hook first** or tell the agent not to capture this\nsession.\n\n### Where data is stored (on your machine only)\n\n- `.reflexio/profiles/` and `.reflexio/playbooks/` — captured `.md` files in\n  the current workspace\n- `.reflexio/.setup_complete_<agentId>` — per-agent bootstrap marker\n- `~/.openclaw/workspace/skills/reflexio-embedded/` — skill files\n- `~/.openclaw/workspace/agents/reflexio-extractor.md`,\n  `~/.openclaw/workspace/agents/reflexio-consolidator.md` — sub-agent defs\n- `~/.openclaw/workspace/plugins/reflexio-embedded/` — prompts and scripts\n\nNo files are written outside these paths. There is no background database,\nno `~/.reflexio/sessions.db`, and no outbound sync.\n\n### Privileged install-time side effects\n\n`./scripts/install.sh` (the only install path) makes the following\n**host-wide** changes to your Openclaw install. You must approve these to use\nthe plugin — there is no \"search-only\" subset:\n\n1. Registers this plugin via `openclaw plugins install --link`\n2. **Enables the `active-memory` plugin host-wide** — affects all agents in\n   your Openclaw install, not just agents that use this skill\n3. **Registers a daily cron job** (`reflexio-embedded-consolidate`) that runs\n   at 3am local time and spawns a sub-agent session\n4. **Restarts the Openclaw gateway** at the end of install\n\nThe per-agent bootstrap (run by SKILL.md on first skill invocation) also\nprompts to run `openclaw config set` against\n`plugins.entries.active-memory.config.agents` and\n`agents.defaults.memorySearch.extraPaths`. You can decline either; the\nconsequences are documented in the SKILL.md bootstrap section.\n\n### How to disable\n\n- **Per-session**, stop auto-capture and extraction:\n  `openclaw hooks disable reflexio-embedded`\n- **Per-session**, tell the agent to skip Reflexio writes — in-session Flow\n  A/B will stop; still disable the hook to prevent Flow C at session end\n- **Remove entirely**: `./scripts/uninstall.sh` (preserves `.reflexio/` data)\n  or `./scripts/uninstall.sh --purge` (also deletes user data)\n- **Stop the cron without uninstalling**:\n  `openclaw cron rm reflexio-embedded-consolidate`\n\n---\n\n\n## First-Use Setup\n\nThis plugin requires a one-time install script **before** any agent can use\nit. Read the Privacy, Credentials & Persistence section above first — the\ninstall script makes host-wide changes to your Openclaw installation.\n\n```bash\n# After downloading this skill from ClawHub (or cloning the source repo):\n./scripts/install.sh\n```\n\n**Prerequisites** (install script checks these):\n\n- `openclaw` CLI on PATH\n- `node` on PATH\n- bash-compatible shell (macOS / Linux / WSL)\n\n**Strongly recommended** (plugin works without them, with degraded retrieval):\n\n- An embedding provider configured in Openclaw (OpenAI, Gemini, Voyage, or\n  Mistral) — enables vector search; without it, retrieval falls back to\n  FTS-only\n- The `active-memory` plugin available in your Openclaw install — without it,\n  you must call `memory_search` explicitly at turn start\n\n**The plugin declares no API key of its own** — it relies on the LLM\nOpenclaw is already configured with for extraction and embedding. Configure a\nlocal LLM (Ollama, LM Studio, vLLM) in Openclaw if you need fully offline\noperation. See the Privacy section above for what excerpts traverse that\nprovider.\n\nAfter install, the first time an agent uses this skill, SKILL.md runs a\none-time per-agent bootstrap that may prompt for additional `openclaw config\nset` calls. You can decline; degraded modes are documented.\n\n**Uninstall**: `./scripts/uninstall.sh` (preserves `.reflexio/`) or\n`./scripts/uninstall.sh --purge` (deletes user data too). Also removes the\ncron and the host-wide workspace files.\n\n---\n\n\n# Reflexio Embedded Skill\n\nCaptures user facts (profiles) and procedural corrections (playbooks) into `.reflexio/`, so the agent learns across sessions. All memory lives in Openclaw's native primitives — no external service required.\n\n## First-time setup per agent\n\nIf `.reflexio/.setup_complete_<agentId>` does NOT exist (where `<agentId>` is your current agent id), perform this one-time check. The setup step runs probing commands via `exec` and asks for approval before making changes.\n\n**Steps:**\n\n1. Probe current config:\n   - `openclaw config get plugins.entries.active-memory.config.agents`\n   - `openclaw config get agents.defaults.memorySearch.extraPaths`\n   - `openclaw memory status --deep`\n\n2. If active-memory is not targeting this agent:\n   Ask user: *\"To auto-inject relevant facts into each turn, I can enable active-memory for this agent. OK if I run `openclaw config set plugins.entries.active-memory.config.agents '[\\\"<agentId>\\\"]' --strict-json`?\"*\n   On approval, run the command.\n\n3. If `.reflexio/` is not registered as an extraPath:\n   Ask user: *\"I need to register .reflexio/ as a memory path. OK if I run `openclaw config set agents.defaults.memorySearch.extraPaths '[\\\".reflexio/\\\"]' --strict-json`?\"*\n   On approval, run the command.\n\n4. If no embedding provider is configured (FTS-only mode):\n   Tell user: *\"Vector search requires an embedding API key (OpenAI, Gemini, Voyage, or Mistral). The plugin works without one but retrieval quality drops. Would you like guidance on adding one?\"*\n   If yes, guide them through `openclaw config set` or `openclaw configure`.\n\n5. On each decline, note the degraded mode but do not block:\n   - No active-memory → you must run `memory_search` explicitly at turn start (see \"Retrieval\" section below).\n   - No extraPath → WARN the user the plugin cannot function without this step.\n   - No embedding → continue with FTS-only.\n\n6. When all checks resolved (approved or accepted with warning): create the marker:\n   ```bash\n   mkdir -p .reflexio\n   touch .reflexio/.setup_complete_<agentId>\n   ```\n\n**If exec is not available** (strict admin policy): fall back to telling the user the exact commands to run manually.\n\n## First-Use Initialisation\n\nBefore any write, ensure `.reflexio/` and its subdirectories exist. This is idempotent — safe to run every session:\n\n```bash\nmkdir -p .reflexio/profiles .reflexio/playbooks\n```\n\nNever overwrite existing files. Never write secrets, tokens, private keys, environment variables, or credentials into `.reflexio/` files. When capturing a fact involves a user-pasted snippet that contains credentials, redact first.\n\n> **Redaction boundary.** The hook (Flow C) runs a best-effort regex scrub for common credential patterns (API keys, bearer tokens, PEM private keys, `*_SECRET`/`*_PASSWORD` env assignments, JWTs) on the transcript *before* it is sent to the extractor sub-agent — which may in turn call a hosted LLM provider. This is a backstop, not a guarantee. You (the agent) are still responsible for never copying secrets into `.reflexio/` writes in Flows A/B, and the user is responsible for not pasting secrets into sessions. See `SECURITY.md` for the full threat model.\n\n## Quick Reference\n\n| Situation                                                 | Action                                     |\n|-----------------------------------------------------------|--------------------------------------------|\n| User states preference, fact, config, or constraint       | Write profile via `reflexio-write.sh`      |\n| User correction → you adjust → user confirms              | Write playbook via `reflexio-write.sh`     |\n| Start of user turn, no Active Memory injection appeared   | Run `memory_search` fallback (see below)   |\n| Unsure whether to capture                                 | Skip; batch pass at session-end has a second shot |\n\n## Detection Triggers\n\n### Profile signals (write immediately, same turn)\n\n- **Preferences**: \"I prefer X\", \"I like Y\", \"I don't like Z\", \"I always do Q\"\n- **Facts about self**: \"I'm a [role]\", \"my timezone is X\", \"I've been doing Y for Z years\"\n- **Config**: \"use X\", \"our team uses Y\", \"the repo is at Z\"\n- **Constraints**: \"I'm vegetarian\", \"no dairy\", \"I can't X\", \"don't use Y\"\n\nFor each such signal, invoke `reflexio-write.sh` with a kebab-case topic slug and an appropriate TTL. See \"TTL Selection\" below.\n\n### Playbook signals (write AFTER confirmation)\n\nPlaybooks require a specific multi-turn pattern:\n\n1. **Correction**: *\"No, that's wrong\"*, *\"Actually...\"*, *\"Don't do X\"*, *\"Not like that\"*, *\"We don't use X here\"*.\n2. **You adjust**: you redo the work per the correction.\n3. **Confirmation** (required — without this, do NOT write a playbook):\n   - Explicit: *\"good\"*, *\"perfect\"*, *\"yes that's right\"*, *\"correct\"*.\n   - Implicit: the user moves to an unrelated topic without re-correcting for 1-2 more turns.\n\n**Explicit don't-write rule**: if you see a correction without subsequent confirmation, do not write a playbook. The fix may be wrong; let the batch pass at session end re-evaluate.\n\n## Retrieval\n\n### When Active Memory is enabled\n\nYour turn context may already contain Reflexio-prefixed entries injected by Active Memory. Incorporate them before responding. No tool call needed.\n\n### Fallback when Active Memory is absent\n\nAt the start of each user turn, call:\n\n```\nmemory_search(query=<user's current message>, filter={type: profile|playbook})\n```\n\nIncorporate any `.reflexio/`-sourced results before responding. Skip if the user's message is trivial (greeting, acknowledgment).\n\n## File Format\n\n**Do NOT construct filenames or frontmatter by hand.** Use `./scripts/reflexio-write.sh` (via the `exec` tool). The script generates IDs, enforces the frontmatter schema, and writes atomically.\n\n### Profile template (for mental model — the script emits this)\n\n```markdown\n---\ntype: profile\nid: prof_<nanoid>\ncreated: <ISO timestamp>\nttl: <enum>\nexpires: <ISO date or \"never\">\nsupersedes: [<old_id>]   # optional, only after a merge\n---\n\n<1-3 sentences, one fact per file>\n```\n\n### Playbook template\n\n```markdown\n---\ntype: playbook\nid: pbk_<nanoid>\ncreated: <ISO timestamp>\nsupersedes: [<old_id>]   # optional\n---\n\n## When\n<1-sentence trigger — this is the search anchor; make it a noun phrase>\n\n## What\n<2-3 sentences of the procedural rule; DO / DON'T as actually observed>\n\n## Why\n<rationale, can be longer — reference only, not recall content>\n```\n\n### How to invoke `reflexio-write.sh`\n\n**Profile:**\n\n```bash\necho \"User is vegetarian — no meat or fish.\" | \\\n  ./scripts/reflexio-write.sh profile diet-vegetarian one_year\n```\n\n**Playbook:**\n\n```bash\n./scripts/reflexio-write.sh playbook commit-no-ai-attribution -\n\nArchive v1.0.7: 29 files, 46174 bytes\n\nFiles: _meta.json (127b), agents/reflexio-consolidator.md (2098b), agents/reflexio-extractor.md (2337b), assets/playbook_template.md (372b), assets/profile_template.md (276b), commands/reflexio-consolidate/SKILL.md (1810b), config.json (250b), hook/handler.ts (6773b), hook/HOOK.md (610b), hook/smoke-test.ts (3688b), index.ts (3529b), openclaw.plugin.json (1161b), package.json (378b), prompts/full_consolidation.md (2009b), prompts/playbook_extraction.md (14194b), prompts/profile_extraction.md (7832b), prompts/README.md (1230b), prompts/shallow_dedup_pairwise.md (1742b), README.md (5790b), references/architecture.md (3024b), references/comparison.md (1881b), references/future-work.md (2993b), references/porting-notes.md (3532b), scripts/install.sh (3758b), scripts/reflexio-write.sh (6945b), scripts/uninstall.sh (1334b), SKILL.md (16850b), tsconfig.json (296b), types/openclaw.d.ts (4537b)\n\nArchive v1.0.6: 10 files, 35741 bytes\n\nFiles: commands/reflexio-aggregate/SKILL.md (2856b), commands/reflexio-extract/SKILL.md (8077b), hook/handler.js (16340b), hook/HOOK.md (4915b), hook/package.json (502b), README.md (14553b), rules/reflexio.md (3472b), SKILL.md (22775b), skill/SKILL.md (15981b), _meta.json (127b)\n\nArchive v1.0.5: 10 files, 33584 bytes\n\nFiles: commands/reflexio-aggregate/SKILL.md (2856b), commands/reflexio-extract/SKILL.md (8077b), hook/handler.js (16340b), hook/HOOK.md (4035b), hook/package.json (502b), README.md (14553b), rules/reflexio.md (3035b), SKILL.md (19304b), skill/SKILL.md (14432b), _meta.json (127b)\n\nArchive v1.0.4: 10 files, 31558 bytes\n\nFiles: commands/reflexio-aggregate/SKILL.md (2856b), commands/reflexio-extract/SKILL.md (8077b), hook/handler.ts (16231b), hook/HOOK.md (2842b), hook/package.json (502b), README.md (14553b), rules/reflexio.md (2600b), SKILL.md (17175b), skill/SKILL.md (13015b), _meta.json (127b)\n\nArchive v1.0.3: 10 files, 32324 bytes\n\nFiles: commands/reflexio-aggregate/SKILL.md (2856b), commands/reflexio-extract/SKILL.md (8077b), hook/handler.ts (19347b), hook/HOOK.md (2842b), hook/package.json (502b), README.md (14553b), rules/reflexio.md (2600b), SKILL.md (16681b), skill/SKILL.md (13015b), _meta.json (127b)\n\nArchive v1.0.2: 10 files, 32356 bytes\n\nFiles: commands/reflexio-aggregate/SKILL.md (2956b), commands/reflexio-extract/SKILL.md (8242b), hook/handler.ts (19936b), hook/HOOK.md (2985b), hook/package.json (502b), README.md (14766b), rules/reflexio.md (2692b), SKILL.md (16155b), skill/SKILL.md (12720b), _meta.json (127b)\n\nArchive v1.0.1: 10 files, 31780 bytes\n\nFiles: commands/reflexio-aggregate/SKILL.md (2956b), commands/reflexio-extract/SKILL.md (8242b), hook/handler.ts (19256b), hook/HOOK.md (2423b), hook/package.json (502b), README.md (14766b), rules/reflexio.md (2692b), SKILL.md (16155b), skill/SKILL.md (12720b), _meta.json (127b)","readmeExcerpt":"Skill: Reflexio Owner: yyiilluu Summary: Captures user facts and procedural corrections into .reflexio/ so the agent learns across sessions. Use when: (1) user states a preference, fact, config, or... Tags: latest:1.0.10 Version history: v1.0.10 | 2026-04-22T07:42:00.084Z | user **Reflexio v1.0.10 — Major re-architecture: now runs fully local, storing all memory in .reflexio/ using only OpenClaw primitives.** - Repla","codeSnippets":[],"executableExamples":[{"language":"bash","snippet":"mkdir -p .reflexio\n   touch .reflexio/.setup_complete_<agentId>"},{"language":"bash","snippet":"mkdir -p .reflexio/profiles .reflexio/playbooks"},{"language":"markdown","snippet":"---\ntype: profile\nid: prof_<nanoid>\ncreated: <ISO timestamp>\nttl: <enum>\nexpires: <ISO date or \"never\">\nsupersedes: [<old_id>]   # optional, only after a merge\n---\n\n<1-3 sentences, one fact per file>"},{"language":"markdown","snippet":"---\ntype: playbook\nid: pbk_<nanoid>\ncreated: <ISO timestamp>\nsupersedes: [<old_id>]   # optional\n---\n\n## When\n<1-sentence trigger — this is the search anchor; make it a noun phrase>\n\n## What\n<2-3 sentences of the procedural rule; DO / DON'T as actually observed>\n\n## Why\n<rationale, can be longer — reference only, not recall content>"},{"language":"bash","snippet":"mkdir -p .reflexio\n   touch .reflexio/.setup_complete_<agentId>"},{"language":"bash","snippet":"mkdir -p .reflexio/profiles .reflexio/playbooks"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: reflexio-embedded\ndescription: \"Captures user facts and procedural corrections into .reflexio/ so the agent learns across sessions. Use when: (1) user states a preference, fact, config, or constraint; (2) user corrects the agent and confirms the fix with an explicit 'good'/'perfect' or by moving on without re-correcting for 1-2 turns; (3) at start of a user turn, to retrieve relevant facts and playbooks from past sessions.\"\nmetadata:\n---\n\n# Reflexio Embedded Skill\n\nCaptures user facts (profiles) and procedural corrections (playbooks) into `.reflexio/`, so the agent learns across sessions. All memory lives in Openclaw's native primitives — no external service required.\n\n## First-time setup per agent\n\nIf `.reflexio/.setup_complete_<agentId>` does NOT exist (where `<agentId>` is your current agent id), perform this one-time check. The setup step runs probing commands via `exec` and asks for approval before making changes.\n\n**Steps:**\n\n1. Probe current config:\n   - `openclaw config get plugins.entries.active-memory.config.agents`\n   - `openclaw config get agents.defaults.memorySearch.extraPaths`\n   - `openclaw memory status --deep`\n\n2. If active-memory is not targeting this agent:\n   Ask user: *\"To auto-inject relevant facts into each turn, I can enable active-memory for this agent. OK if I run `openclaw config set plugins.entries.active-memory.config.agents '[\\\"<agentId>\\\"]' --strict-json`?\"*\n   On approval, run the command.\n\n3. If `.reflexio/` is not registered as an extraPath:\n   Ask user: *\"I need to register .reflexio/ as a memory path. OK if I run `openclaw config set agents.defaults.memorySearch.extraPaths '[\\\".reflexio/\\\"]' --strict-json`?\"*\n   On approval, run the command.\n\n4. If no embedding provider is configured (FTS-only mode):\n   Tell user: *\"Vector search requires an embedding API key (OpenAI, Gemini, Voyage, or Mistral). The plugin works without one but retrieval quality drops. Would you like guidance on adding one?\"*\n   If yes, guide them through `openclaw config set` or `openclaw configure`.\n\n5. On each decline, note the degraded mode but do not block:\n   - No active-memory → you must run `openclaw memory search` via exec at turn start (see \"Retrieval\" section below).\n   - No extraPath → WARN the user the plugin cannot function without this step.\n   - No embedding → continue with FTS-only.\n\n6. When all checks resolved (approved or accepted with warning): create the marker:\n   ```bash\n   mkdir -p .reflexio\n   touch .reflexio/.setup_complete_<agentId>\n   ```\n\n**If exec is not available** (strict admin policy): fall back to telling the user the exact commands to run manually.\n\n## First-Use Initialisation\n\nBefore any write, ensure `.reflexio/` and its subdirectories exist. This is idempotent — safe to run every session:\n\n```bash\nmkdir -p .reflexio/profiles .reflexio/playbooks\n```\n\nNever overwrite existing files. Never write secrets, tokens, private keys, environment variables, or credentials into `.reflexio/` files. When captu"},{"path":"skills/reflexio-consolidate/SKILL.md","content":"---\nname: reflexio-consolidate\ndescription: \"Run a full-sweep consolidation over all .reflexio/ files — TTL sweep + n-way cluster merge. Use when the user asks to 'clean up reflexio', 'consolidate memory', 'deduplicate playbooks', or suspects drift across sessions.\"\n---\n\n# Reflexio Consolidate\n\nUser-invocable via `/skill reflexio-consolidate`. Same workflow that runs automatically via heartbeat (every 24h of active use), but on-demand.\n\n## What it does\n\n1. TTL sweep: delete expired profile files.\n2. For each of profiles and playbooks:\n   - Cluster similar files via `memory_search`.\n   - For clusters of 2+ members, call `llm-task` with `prompts/full_consolidation.md` to decide consolidate (one-fact-per-file) or keep-all.\n   - Apply decisions: write individual fact files, delete originals.\n\n## How to run\n\nCall the `reflexio_run_consolidation` tool. It spawns the consolidator sub-agent and returns a `runId`.\n\nAfter successful consolidation, call the `reflexio_consolidation_mark_done` tool to update the heartbeat timer.\n\n## When to use\n\n- User asks to \"consolidate\", \"clean up reflexio\", \"dedupe memory\"\n- User reports seeing duplicate or contradictory entries in retrieval\n- Heartbeat check returns ALERT (automatic trigger)\n\n## When NOT to use\n\n- Routine maintenance — heartbeat handles this automatically.\n- Immediately after Flow A/B writes — shallow dedup at write time + Flow C at session end cover the fresh-extraction cases."},{"path":"skills/reflexio-embedded/SKILL.md","content":"---\nname: reflexio-embedded\ndescription: \"Captures user facts and procedural corrections into .reflexio/ so the agent learns across sessions. Use when: (1) user states a preference, fact, config, or constraint; (2) user corrects the agent and confirms the fix with an explicit 'good'/'perfect' or by moving on without re-correcting for 1-2 turns; (3) at start of a user turn, to retrieve relevant facts and playbooks from past sessions.\"\nmetadata:\n---\n\n# Reflexio Embedded Skill\n\nCaptures user facts (profiles) and procedural corrections (playbooks) into `.reflexio/`, so the agent learns across sessions. All memory lives in Openclaw's native primitives — no external service required.\n\n## First-time setup per agent\n\nIf `.reflexio/.setup_complete_<agentId>` does NOT exist (where `<agentId>` is your current agent id), perform this one-time check. The setup step runs probing commands via `exec` and asks for approval before making changes.\n\n**Steps:**\n\n1. Probe current config:\n   - `openclaw config get plugins.entries.active-memory.config.agents`\n   - `openclaw config get agents.defaults.memorySearch.extraPaths`\n   - `openclaw memory status --deep`\n\n2. If active-memory is not targeting this agent:\n   Ask user: *\"To auto-inject relevant facts into each turn, I can enable active-memory for this agent. OK if I run `openclaw config set plugins.entries.active-memory.config.agents '[\\\"<agentId>\\\"]' --strict-json`?\"*\n   On approval, run the command.\n\n3. If `.reflexio/` is not registered as an extraPath:\n   Ask user: *\"I need to register .reflexio/ as a memory path. OK if I run `openclaw config set agents.defaults.memorySearch.extraPaths '[\\\".reflexio/\\\"]' --strict-json`?\"*\n   On approval, run the command.\n\n4. If no embedding provider is configured (FTS-only mode):\n   Tell user: *\"Vector search requires an embedding API key (OpenAI, Gemini, Voyage, or Mistral). The plugin works without one but retrieval quality drops. Would you like guidance on adding one?\"*\n   If yes, guide them through `openclaw config set` or `openclaw configure`.\n\n5. On each decline, note the degraded mode but do not block:\n   - No active-memory → you must run `openclaw memory search` via exec at turn start (see \"Retrieval\" section below).\n   - No extraPath → WARN the user the plugin cannot function without this step.\n   - No embedding → continue with FTS-only.\n\n6. When all checks resolved (approved or accepted with warning): create the marker:\n   ```bash\n   mkdir -p .reflexio\n   touch .reflexio/.setup_complete_<agentId>\n   ```\n\n**If exec is not available** (strict admin policy): fall back to telling the user the exact commands to run manually.\n\n## First-Use Initialisation\n\nBefore any write, ensure `.reflexio/` and its subdirectories exist. This is idempotent — safe to run every session:\n\n```bash\nmkdir -p .reflexio/profiles .reflexio/playbooks\n```\n\nNever overwrite existing files. Never write secrets, tokens, private keys, environment variables, or credentials into `.reflexio/` files. When captu"},{"path":"prompts/README.md","content":"# Openclaw-Embedded Prompts\n\nLLM prompt templates used by Flow C sub-agents and consolidation.\n\n## Files\n\n- `profile_extraction.md` — extract durable user facts from a transcript\n- `playbook_extraction.md` — extract procedural rules from correction+confirmation patterns\n- `full_consolidation.md` — consolidate a cluster of similar items into individual facts\n\n## Format\n\nEach file is a `.prompt.md` with YAML frontmatter (matches Reflexio's\n`server/prompt/prompt_bank/` convention). Unlike upstream's versioned layout\n(`<name>/v<ver>.prompt.md`), we store prompts flat (`<name>.md`) since the\nplugin ships atomically with one active version at a time.\n\n```yaml\n---\nactive: true\ndescription: \"one-line description\"\nchangelog: \"what changed in this version\"\nvariables:\n  - var1\n  - var2\n---\n\nprompt body, with {var1} and {var2} substitution points\n```\n\n## Upstream sync\n\n`profile_extraction.md` and `playbook_extraction.md` are ports of Reflexio's\nprompt_bank entries. On upstream bumps, review the prompt diff against our\nadapted versions. Porting notes will be maintained in\n`../references/porting-notes.md` (added in a later phase)."},{"path":"README.md","content":"# Reflexio Embedded\n\nOpenclaw plugin for user profile and playbook extraction — learns your preferences, corrections, and workflows across sessions using Openclaw's native memory engine, hooks, and sub-agents. No Reflexio server required.\n\n## Prerequisites\n\n- [Openclaw CLI](https://docs.openclaw.ai) (>= 2026.3.24)\n- Node.js\n\n## Install\n\n```bash\n# 1. Install and enable the plugin\nopenclaw plugins install /path/to/this/directory\nopenclaw plugins enable reflexio-embedded\n\n# 2. Enable the active-memory plugin (required for memory search)\nopenclaw plugins enable active-memory\nopenclaw config set plugins.entries.active-memory.config.agents '[\"*\"]'\n\n# 3. Register .reflexio/ as a memory search path\nopenclaw config set agents.defaults.memorySearch.extraPaths '[\".reflexio/\"]' --strict-json\n\n# 4. Restart the gateway to pick up changes\nopenclaw gateway restart\n```\n\nVerify it loaded:\n\n```bash\nopenclaw plugins inspect reflexio-embedded\n```\n\n## Uninstall\n\n```bash\n# 1. Remove the plugin\nopenclaw plugins disable reflexio-embedded\nopenclaw plugins uninstall --force reflexio-embedded\n\n# 2. Clean up state files\nrm -f ~/.openclaw/reflexio-consolidation-state.json\n\n# 3. Restart the gateway\nopenclaw gateway restart\n```\n\nYour `.reflexio/` user data (profiles and playbooks) is preserved by default. To remove it:\n\n```bash\nrm -rf .reflexio/\n```\n\n## What it does\n\n- **Profile extraction** — automatically captures user preferences, facts, and corrections from conversations into `.reflexio/profiles/`\n- **Playbook capture** — records recurring workflows and patterns into `.reflexio/playbooks/`\n- **Dedup and contradiction resolution** — new entries are compared against existing ones via LLM; overlapping content is merged, contradictions resolved (new wins), and non-contradicted facts preserved\n- **Consolidation** — periodic heartbeat-triggered sweep that clusters similar entries and merges duplicates\n- **TTL management** — profiles can have time-to-live values; expired entries are swept automatically\n\n## Configuration\n\nOverride defaults in your `openclaw.json`:\n\n```json\n{\n  \"plugins\": {\n    \"entries\": {\n      \"reflexio-embedded\": {\n        \"config\": {\n          \"dedup\": { \"shallow_threshold\": 0.4, \"top_k\": 5 },\n          \"consolidation\": { \"threshold_hours\": 24 }\n        }\n      }\n    }\n  }\n}\n```\n\n## Learn more\n\nFull project source, design docs, and development setup:\nhttps://github.com/ReflexioAI/reflexio/tree/main/reflexio/integrations/openclaw-embedded"}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":null,"editorialQuality":{"score":100,"threshold":65,"status":"thin","wordCount":2448,"uniquenessScore":36,"reasons":["uniqueness-below-45"]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-12T02:07:26.750Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-12T02:07:26.750Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-12T15:38:49.170Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}