claude-smart 0.2.45 → 0.2.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +3 -3
- package/README.md +47 -10
- package/bin/claude-smart.js +535 -23
- package/package.json +22 -3
- package/plugin/.claude-plugin/plugin.json +4 -2
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/README.md +27 -6
- package/plugin/commands/clear-all.md +1 -0
- package/plugin/commands/dashboard.md +1 -0
- package/plugin/commands/learn.md +1 -0
- package/plugin/commands/restart.md +1 -0
- package/plugin/commands/show.md +1 -0
- package/plugin/dashboard/app/configure/env/page.tsx +40 -14
- package/plugin/dashboard/app/configure/server/page.tsx +51 -1
- package/plugin/dashboard/app/layout.tsx +20 -0
- package/plugin/dashboard/app/preferences/[id]/page.tsx +8 -8
- package/plugin/dashboard/app/skills/project/[id]/page.tsx +7 -3
- package/plugin/dashboard/app/skills/shared/[id]/page.tsx +10 -3
- package/plugin/dashboard/lib/claude-settings-file.ts +20 -10
- package/plugin/dashboard/lib/reflexio-client.ts +16 -0
- package/plugin/dashboard/lib/status.ts +10 -3
- package/plugin/dashboard/lib/types.ts +18 -6
- package/plugin/hooks/codex-hooks.json +0 -1
- package/plugin/opencode/assistant-buffer.ts +108 -0
- package/plugin/opencode/dist/assistant-buffer.js +96 -0
- package/plugin/opencode/dist/internal.js +12 -0
- package/plugin/opencode/dist/payload.js +85 -0
- package/plugin/opencode/dist/server.mjs +232 -0
- package/plugin/opencode/internal.ts +18 -0
- package/plugin/opencode/package.json +3 -0
- package/plugin/opencode/payload.ts +90 -0
- package/plugin/opencode/server.mts +251 -0
- package/plugin/opencode/tsconfig.json +13 -0
- package/plugin/pyproject.toml +25 -4
- package/plugin/scripts/_lib.sh +5 -1
- package/plugin/scripts/backend-service.sh +22 -2
- package/plugin/scripts/ensure-plugin-root.sh +4 -4
- package/plugin/scripts/hook_entry.sh +1 -1
- package/plugin/scripts/opencode-claude-compat +4 -0
- package/plugin/scripts/opencode-claude-compat.cmd +3 -0
- package/plugin/scripts/opencode-claude-compat.js +225 -0
- package/plugin/scripts/smart-install.sh +17 -9
- package/plugin/src/README.md +1 -1
- package/plugin/src/claude_smart/cli.py +498 -12
- package/plugin/src/claude_smart/context_format.py +9 -9
- package/plugin/src/claude_smart/cs_cite.py +66 -19
- package/plugin/src/claude_smart/env_config.py +12 -4
- package/plugin/src/claude_smart/events/session_start.py +26 -7
- package/plugin/src/claude_smart/events/stop.py +1 -1
- package/plugin/src/claude_smart/ids.py +1 -1
- package/plugin/src/claude_smart/reflexio_adapter.py +5 -5
- package/plugin/src/claude_smart/runtime.py +7 -1
- package/plugin/uv.lock +5 -5
- package/plugin/vendor/reflexio/.env.example +54 -30
- package/plugin/vendor/reflexio/README.md +17 -11
- package/plugin/vendor/reflexio/pyproject.toml +13 -1
- package/plugin/vendor/reflexio/reflexio/README.md +4 -1
- package/plugin/vendor/reflexio/reflexio/cli/README.md +9 -7
- package/plugin/vendor/reflexio/reflexio/cli/__main__.py +10 -1
- package/plugin/vendor/reflexio/reflexio/cli/bootstrap_config.py +22 -5
- package/plugin/vendor/reflexio/reflexio/cli/commands/interactions.py +34 -4
- package/plugin/vendor/reflexio/reflexio/cli/commands/profiles.py +12 -7
- package/plugin/vendor/reflexio/reflexio/cli/commands/services.py +13 -6
- package/plugin/vendor/reflexio/reflexio/cli/commands/setup_cmd.py +212 -52
- package/plugin/vendor/reflexio/reflexio/cli/commands/shortcuts.py +15 -2
- package/plugin/vendor/reflexio/reflexio/cli/env_loader.py +292 -22
- package/plugin/vendor/reflexio/reflexio/cli/log_format.py +29 -4
- package/plugin/vendor/reflexio/reflexio/cli/run_services.py +17 -8
- package/plugin/vendor/reflexio/reflexio/cli/stop_services.py +13 -10
- package/plugin/vendor/reflexio/reflexio/cli/utils.py +44 -1
- package/plugin/vendor/reflexio/reflexio/client/client.py +154 -13
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/README.md +135 -257
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/npm/openclaw-smart/bin/openclaw-smart.js +13 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/npm/openclaw-smart/package.json +15 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/README.md +38 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/index.ts +151 -110
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/openclaw.plugin.json +20 -10
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/package.json +28 -6
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/pyproject.toml +42 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/_lib.sh +371 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/backend-log-runner.sh +33 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/backend-service.sh +271 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/cli.sh +68 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/dashboard-open.sh +15 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/ensure-plugin-root.sh +84 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/hook_entry.sh +106 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/npm-cli.js +219 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/smart-install.sh +269 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/skills/clear-all/SKILL.md +8 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/skills/dashboard/SKILL.md +8 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/skills/learn/SKILL.md +10 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/skills/reflexio/SKILL.md +15 -44
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/skills/restart/SKILL.md +6 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/skills/show/SKILL.md +8 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/cli.py +634 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/context_format.py +224 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/context_inject.py +79 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/events/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/events/after_tool_call.py +160 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/events/agent_end.py +187 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/events/before_prompt_build.py +69 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/events/before_tool_call.py +30 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/events/session_end.py +36 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/events/session_start.py +130 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/hook.py +131 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/ids.py +94 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/internal_call.py +75 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/oc_cite.py +196 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/optimizer_assistant.py +272 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/publish.py +96 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/query_compose.py +66 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/reflexio_adapter.py +336 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/runtime.py +47 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/stall_banner.py +61 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/state.py +323 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/integration/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/integration/test_e2e_session_loop.py +190 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/integration/test_publish_to_local_reflexio_integration.py +112 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/integration/test_recursion_guard_integration.py +86 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/integration/test_search_inject_integration.py +144 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_cli.py +184 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_events_after_tool_call.py +142 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_events_agent_end.py +233 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_events_before_prompt_build.py +116 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_events_before_tool_call.py +35 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_events_session_end.py +47 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_events_session_start.py +109 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_hook_dispatch.py +117 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_ids.py +41 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_internal_call.py +50 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_oc_cite.py +88 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_publish.py +48 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_query_compose.py +48 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_reflexio_adapter.py +188 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_runtime.py +41 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_state.py +235 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests-ts/__mocks__/plugin-entry-stub.ts +6 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests-ts/test_npm_cli.test.ts +56 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests-ts/test_shim_dispatch.test.ts +171 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tsconfig.build.json +18 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/{tsconfig.json → plugin/tsconfig.json} +2 -2
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/uv.lock +3835 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/vitest.config.ts +18 -0
- package/plugin/vendor/reflexio/reflexio/lib/_agent_playbook.py +246 -10
- package/plugin/vendor/reflexio/reflexio/lib/_base.py +15 -0
- package/plugin/vendor/reflexio/reflexio/lib/_config.py +11 -4
- package/plugin/vendor/reflexio/reflexio/lib/_generation.py +17 -5
- package/plugin/vendor/reflexio/reflexio/lib/_lineage_parity_readers.py +187 -0
- package/plugin/vendor/reflexio/reflexio/lib/_profiles.py +224 -21
- package/plugin/vendor/reflexio/reflexio/lib/_reflection.py +1 -1
- package/plugin/vendor/reflexio/reflexio/lib/_search.py +52 -25
- package/plugin/vendor/reflexio/reflexio/lib/_user_playbook.py +11 -1
- package/plugin/vendor/reflexio/reflexio/models/api_schema/domain/__init__.py +1 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/domain/entities.py +127 -38
- package/plugin/vendor/reflexio/reflexio/models/api_schema/domain/enums.py +4 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/domain/governance.py +117 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/eval_overview_schema.py +64 -41
- package/plugin/vendor/reflexio/reflexio/models/api_schema/internal_schema.py +19 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/pending_tool_call_schema.py +12 -5
- package/plugin/vendor/reflexio/reflexio/models/api_schema/retriever_schema.py +97 -3
- package/plugin/vendor/reflexio/reflexio/models/api_schema/ui/converters.py +5 -1
- package/plugin/vendor/reflexio/reflexio/models/api_schema/ui/entities.py +5 -1
- package/plugin/vendor/reflexio/reflexio/models/config_schema.py +104 -7
- package/plugin/vendor/reflexio/reflexio/models/structured_output.py +148 -0
- package/plugin/vendor/reflexio/reflexio/server/OVERVIEW.md +3 -3
- package/plugin/vendor/reflexio/reflexio/server/README.md +58 -33
- package/plugin/vendor/reflexio/reflexio/server/__init__.py +29 -5
- package/plugin/vendor/reflexio/reflexio/server/__main__.py +2 -2
- package/plugin/vendor/reflexio/reflexio/server/api.py +899 -103
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/precondition_checks.py +7 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/request_context.py +4 -2
- package/plugin/vendor/reflexio/reflexio/server/auth.py +90 -0
- package/plugin/vendor/reflexio/reflexio/server/billing_meter.py +173 -0
- package/plugin/vendor/reflexio/reflexio/server/billing_signals.py +64 -0
- package/plugin/vendor/reflexio/reflexio/server/cache/reflexio_cache.py +46 -16
- package/plugin/vendor/reflexio/reflexio/server/env_utils.py +65 -0
- package/plugin/vendor/reflexio/reflexio/server/extensions.py +213 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/embedding_service.py +19 -4
- package/plugin/vendor/reflexio/reflexio/server/llm/litellm_client.py +264 -77
- package/plugin/vendor/reflexio/reflexio/server/llm/llm_utils.py +69 -7
- package/plugin/vendor/reflexio/reflexio/server/llm/model_defaults.py +4 -4
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/claude_code_provider.py +1 -1
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/embedding_service_provider.py +75 -16
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/openclaw_provider.py +280 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/rerank/cross_encoder_reranker.py +12 -1
- package/plugin/vendor/reflexio/reflexio/server/llm/token_accounting.py +48 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/tools.py +107 -17
- package/plugin/vendor/reflexio/reflexio/server/operation_limiter.py +360 -4
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.6.0.prompt.md +1 -1
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.7.0.prompt.md +85 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_aggregation/v2.2.0.prompt.md +1 -1
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_aggregation/v2.3.0.prompt.md +253 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.3.2.prompt.md +1 -1
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.3.3.prompt.md +74 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.2.3.prompt.md +1 -1
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.3.0.prompt.md +266 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.4.0.prompt.md +278 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v3.3.0.prompt.md +1 -1
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v3.4.0.prompt.md +137 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main/v1.2.0.prompt.md +1 -1
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main/v1.3.0.prompt.md +34 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_update_instruction_start/v1.0.0.prompt.md +5 -12
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_update_instruction_start/v1.1.0.prompt.md +5 -12
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_update_instruction_start/v1.2.0.prompt.md +155 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/tagging/v1.0.0.prompt.md +23 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_manager.py +89 -32
- package/plugin/vendor/reflexio/reflexio/server/services/README.md +28 -11
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/README.md +22 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/__init__.py +1 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/agent_success_evaluation_constants.py +4 -2
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/agent_success_evaluation_utils.py +1 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/components/__init__.py +7 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/{agent_success_evaluator.py → components/evaluator.py} +3 -16
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/regen_jobs.py +28 -72
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/{group_evaluation_runner.py → runner.py} +12 -10
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/{delayed_group_evaluator.py → scheduler.py} +10 -2
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/{agent_success_evaluation_service.py → service.py} +36 -1
- package/plugin/vendor/reflexio/reflexio/server/services/base_generation_service.py +160 -0
- package/plugin/vendor/reflexio/reflexio/server/services/configurator/base_configurator.py +5 -0
- package/plugin/vendor/reflexio/reflexio/server/services/deduplication_utils.py +1 -1
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/README.md +9 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/components/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/{rule_attribution.py → components/rule_attribution.py} +10 -9
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/eval_sampler.py +15 -24
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/service.py +238 -164
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/README.md +31 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/outcome.py +13 -3
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/pending_tool_call_dispatch.py +3 -2
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/resumable_agent.py +32 -118
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/resume_worker.py +47 -16
- package/plugin/vendor/reflexio/reflexio/server/services/generation_service.py +105 -23
- package/plugin/vendor/reflexio/reflexio/server/services/governance/config.py +52 -0
- package/plugin/vendor/reflexio/reflexio/server/services/governance/service.py +378 -0
- package/plugin/vendor/reflexio/reflexio/server/services/governance/subject_refs.py +34 -0
- package/plugin/vendor/reflexio/reflexio/server/services/lineage/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/services/lineage/gc_scheduler.py +219 -0
- package/plugin/vendor/reflexio/reflexio/server/services/lineage/resolve.py +98 -0
- package/plugin/vendor/reflexio/reflexio/server/services/operation_state_utils.py +26 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/README.md +18 -11
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/aggregation_prompt_processing.py +100 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/components/__init__.py +5 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/{playbook_aggregator.py → components/aggregator.py} +334 -178
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/{playbook_consolidator.py → components/consolidator.py} +168 -62
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/{playbook_extractor.py → components/extractor.py} +5 -1
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_edit_apply.py +74 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_service_utils.py +33 -3
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/{playbook_generation_service.py → service.py} +121 -19
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/README.md +10 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/models.py +2 -1
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/optimizer.py +178 -30
- package/plugin/vendor/reflexio/reflexio/server/services/pre_retrieval/README.md +9 -0
- package/plugin/vendor/reflexio/reflexio/server/services/profile/components/__init__.py +17 -0
- package/plugin/vendor/reflexio/reflexio/server/services/profile/{profile_deduplicator.py → components/consolidator.py} +7 -6
- package/plugin/vendor/reflexio/reflexio/server/services/profile/{profile_extractor.py → components/extractor.py} +31 -22
- package/plugin/vendor/reflexio/reflexio/server/services/profile/profile_generation_service_utils.py +6 -13
- package/plugin/vendor/reflexio/reflexio/server/services/profile/{profile_generation_service.py → service.py} +32 -50
- package/plugin/vendor/reflexio/reflexio/server/services/reflection/__init__.py +4 -8
- package/plugin/vendor/reflexio/reflexio/server/services/reflection/components/__init__.py +7 -0
- package/plugin/vendor/reflexio/reflexio/server/services/reflection/reflection_service_utils.py +12 -1
- package/plugin/vendor/reflexio/reflexio/server/services/reflection/{reflection_service.py → service.py} +36 -16
- package/plugin/vendor/reflexio/reflexio/server/services/retrieval/recency.py +211 -0
- package/plugin/vendor/reflexio/reflexio/server/services/retrieval/relevance_floor.py +99 -6
- package/plugin/vendor/reflexio/reflexio/server/services/service_utils.py +36 -1
- package/plugin/vendor/reflexio/reflexio/server/services/shadow_comparison/README.md +8 -0
- package/plugin/vendor/reflexio/reflexio/server/services/shadow_comparison/outcome.py +1 -2
- package/plugin/vendor/reflexio/reflexio/server/services/storage/error.py +31 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/governance_validation.py +681 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/retention.py +9 -9
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/__init__.py +16 -2
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_agent_run.py +4 -1
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_base.py +644 -197
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_extras.py +106 -119
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_governance.py +1965 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_lineage.py +630 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_operations.py +38 -6
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_playbook.py +31 -1369
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_profiles.py +756 -210
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_requests.py +148 -34
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_shadow_verdicts.py +23 -9
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_stall_state.py +5 -2
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/playbook/__init__.py +13 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/playbook/_agent.py +952 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/playbook/_eval_results.py +189 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/playbook/_optimization.py +247 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/playbook/_source_linkage.py +145 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/playbook/_user.py +838 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/__init__.py +150 -23
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_agent_run.py +2 -8
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_base.py +5 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_extras.py +40 -57
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_governance.py +148 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_lineage.py +215 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_operations.py +20 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_playbook.py +4 -677
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_profiles.py +134 -1
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_requests.py +62 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_retrieval_log.py +51 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_shadow_verdicts.py +17 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/playbook/__init__.py +13 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/playbook/_agent.py +365 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/playbook/_eval_results.py +124 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/playbook/_optimization.py +85 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/playbook/_source_linkage.py +47 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/playbook/_user.py +333 -0
- package/plugin/vendor/reflexio/reflexio/server/services/tagging/README.md +8 -0
- package/plugin/vendor/reflexio/reflexio/server/services/tagging/__init__.py +1 -0
- package/plugin/vendor/reflexio/reflexio/server/services/tagging/service.py +200 -0
- package/plugin/vendor/reflexio/reflexio/server/services/tagging/tagging_scheduler.py +149 -0
- package/plugin/vendor/reflexio/reflexio/server/services/unified_search_service.py +372 -34
- package/plugin/vendor/reflexio/reflexio/server/site_var/README.md +2 -1
- package/plugin/vendor/reflexio/reflexio/server/site_var/feature_flags.py +120 -1
- package/plugin/vendor/reflexio/reflexio/server/site_var/site_var_sources/feature_flags.json +4 -0
- package/plugin/vendor/reflexio/reflexio/server/site_var/site_var_sources/search_settings.json +5 -0
- package/plugin/vendor/reflexio/reflexio/server/tracing.py +30 -0
- package/plugin/vendor/reflexio/reflexio/server/usage_metrics.py +18 -0
- package/plugin/vendor/reflexio/reflexio/test_support/llm_mock.py +61 -26
- package/plugin/vendor/reflexio/reflexio/test_support/llm_model_registry.py +41 -4
- package/scripts/setup-claude-smart.sh +8 -3
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/TESTING.md +0 -517
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/hook/handler.js +0 -473
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/package-lock.json +0 -2156
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/package.json +0 -18
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/hook/handler.ts +0 -241
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/hook/setup.ts +0 -140
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/publish.ts +0 -113
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/search.ts +0 -52
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/server.ts +0 -103
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/sqlite-buffer.ts +0 -156
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/user-id.ts +0 -134
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/rules/reflexio.md +0 -24
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/publish_clawhub.sh +0 -278
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/references/HOOK.md +0 -164
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/scripts/install.sh +0 -36
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/scripts/uninstall.sh +0 -35
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/publish.test.ts +0 -27
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/search.test.ts +0 -31
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/server.test.ts +0 -42
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/setup.test.ts +0 -49
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/sqlite-buffer.test.ts +0 -91
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/user-id.test.ts +0 -50
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/vitest.config.ts +0 -13
- package/plugin/vendor/reflexio/reflexio/server/_auth.py +0 -25
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/group_aggregation.py +0 -192
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/invariants.py +0 -303
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/plan.py +0 -138
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/tools.py +0 -1125
- /package/plugin/vendor/reflexio/reflexio/integrations/{__init__.py → openclaw/plugin/src/openclaw_smart/__init__.py} +0 -0
- /package/plugin/vendor/reflexio/reflexio/integrations/openclaw/{types → plugin/types}/openclaw.d.ts +0 -0
- /package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/{distribution.py → components/distribution.py} +0 -0
- /package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/{hero_state.py → components/hero_state.py} +0 -0
- /package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/{shadow_aggregation.py → components/shadow_aggregation.py} +0 -0
- /package/plugin/vendor/reflexio/reflexio/server/services/reflection/{reflection_extractor.py → components/extractor.py} +0 -0
|
@@ -1,274 +1,152 @@
|
|
|
1
|
-
#
|
|
1
|
+
# openclaw-smart
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
openclaw-smart is the openClaw plugin counterpart of
|
|
4
|
+
[claude-smart](https://github.com/reflexio-ai/claude-smart): a thin TS shim
|
|
5
|
+
plus a Python (`openclaw_smart`) package that wires openClaw's plugin hooks
|
|
6
|
+
into a local [Reflexio](https://github.com/reflexio-ai/reflexio) backend
|
|
7
|
+
running at `http://localhost:8071/`. The port matches claude-smart so both
|
|
8
|
+
plugins share one bundled reflexio (one SQLite store, one extractor), and
|
|
9
|
+
leaves reflexio's own 8061 default free for developer use. Conversations
|
|
10
|
+
are buffered to a JSONL session log, published for extraction (skills +
|
|
11
|
+
preferences) via your own LLM, and the top-matching items are injected
|
|
12
|
+
back into every subsequent turn as `prependContext`. The plugin degrades
|
|
13
|
+
silently when the backend is unreachable.
|
|
4
14
|
|
|
5
|
-
##
|
|
15
|
+
## Quick install
|
|
6
16
|
|
|
7
|
-
|
|
8
|
-
- [Multi-User Architecture](#multi-user-architecture)
|
|
9
|
-
- [Prerequisites](#prerequisites)
|
|
10
|
-
- [Installation](#installation)
|
|
11
|
-
- [First-Use Setup](#first-use-setup)
|
|
12
|
-
- [Configuration](#configuration)
|
|
13
|
-
- [Using `reflexio_publish` Tool](#using-reflexio_publish-tool)
|
|
14
|
-
- [Cross-Session Retrieval](#cross-session-retrieval)
|
|
15
|
-
- [File Structure](#file-structure)
|
|
16
|
-
- [Comparison with openclaw-embedded](#comparison-with-openclaw-embedded)
|
|
17
|
-
- [Uninstall](#uninstall)
|
|
18
|
-
- [Manual Testing](#manual-testing)
|
|
19
|
-
|
|
20
|
-
## How It Works
|
|
21
|
-
|
|
22
|
-
The plugin has three independent mechanisms:
|
|
23
|
-
|
|
24
|
-
### 1. Capture (Automatic via Hook)
|
|
25
|
-
|
|
26
|
-
```
|
|
27
|
-
Each Turn (message:sent)
|
|
28
|
-
└── Buffer (user message, agent response) → local SQLite (~/.reflexio/sessions.db)
|
|
29
|
-
|
|
30
|
-
Session End (command:stop)
|
|
31
|
-
└── Flush all buffered turns to Reflexio server via reflexio_publish CLI
|
|
32
|
-
└── Server automatically:
|
|
33
|
-
1. Analyzes conversation via LLM pipeline
|
|
34
|
-
2. Extracts playbooks: behavior instructions with context (trigger, rationale, blocking_issue)
|
|
35
|
-
3. Extracts user profiles: preferences, expertise, communication patterns
|
|
36
|
-
4. Stores everything with vector embeddings for semantic search
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
Correction detection happens **server-side via LLM** — the plugin does not detect corrections itself.
|
|
40
|
-
|
|
41
|
-
### 2. Retrieve (Automatic via Hook Injection)
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
Per-message (message:received hook — automatic)
|
|
45
|
-
└── Hook injects search results from reflexio search before every agent response
|
|
46
|
-
└── Returns user playbooks + agent playbooks relevant to the current message
|
|
47
|
-
└── Semantic search matches message content against playbook triggers
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
Both user playbooks (corrections specific to this agent instance) and agent playbooks (shared corrections aggregated from all instances) are returned and injected as context.
|
|
51
|
-
|
|
52
|
-
### 3. Aggregate (Automatic, optional manual trigger)
|
|
53
|
-
|
|
54
|
-
```
|
|
55
|
-
After each publish
|
|
56
|
-
└── Aggregation runs in background automatically
|
|
57
|
-
└── Clusters similar user playbooks across all agent instances
|
|
58
|
-
└── Deduplicates and consolidates into shared agent playbooks
|
|
59
|
-
└── New agent playbooks start as PENDING → can be reviewed → APPROVED/REJECTED
|
|
60
|
-
|
|
61
|
-
Manual trigger
|
|
62
|
-
└── reflexio agent-playbooks aggregate (CLI)
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Agent playbooks accumulate corrections from all agent instances, so every instance benefits from corrections made by any other instance.
|
|
66
|
-
|
|
67
|
-
## Multi-User Architecture
|
|
68
|
-
|
|
69
|
-
Each OpenClaw agent (identified by its `agentId`) is treated as a distinct Reflexio user. This enables per-agent learning isolation alongside cross-agent shared learning:
|
|
70
|
-
|
|
71
|
-
```
|
|
72
|
-
~/.openclaw/
|
|
73
|
-
├── agents/
|
|
74
|
-
│ ├── main/ → Reflexio user_id: "main"
|
|
75
|
-
│ ├── work/ → Reflexio user_id: "work"
|
|
76
|
-
│ └── ops/ → Reflexio user_id: "ops"
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
- **User playbooks**: per-agent corrections, isolated by `agentId`. Mistakes made by `main` are tracked separately from mistakes made by `work`.
|
|
80
|
-
- **Agent playbooks**: shared corrections aggregated from ALL agents. Once a correction is aggregated and approved, every instance sees it via `reflexio search`.
|
|
81
|
-
- **`user_id`** is derived from the OpenClaw session key prefix (`agent:<id>:...`), with fallback to `openclaw`. There is no override — the hook is deliberately locked to automatic identity resolution to eliminate env-var reads.
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
## Prerequisites
|
|
85
|
-
|
|
86
|
-
- [OpenClaw](https://openclaw.ai) installed and running
|
|
87
|
-
- [Node.js](https://nodejs.org/) 18+ (for the plugin runtime)
|
|
88
|
-
- The `reflexio` CLI on PATH: `pipx install reflexio-ai` (or `pip install --user reflexio-ai`)
|
|
89
|
-
- An LLM API key for the Reflexio server (e.g., `OPENAI_API_KEY`) — required for playbook/profile extraction but read only by the server, never by the hook
|
|
90
|
-
|
|
91
|
-
Supported LLM providers: OpenAI, Anthropic, Google Gemini, DeepSeek, OpenRouter, MiniMax, DashScope, xAI, Moonshot, ZAI, or any local LLM endpoint (Ollama, LM Studio, vLLM).
|
|
92
|
-
|
|
93
|
-
## Installation
|
|
94
|
-
|
|
95
|
-
### Option 1 — ClawHub (recommended)
|
|
17
|
+
Guided Reflexio setup:
|
|
96
18
|
|
|
97
19
|
```bash
|
|
98
|
-
|
|
20
|
+
reflexio setup openclaw
|
|
99
21
|
```
|
|
100
22
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
### Option 2 — From Source (if you have `reflexio-ai` and Node.js installed)
|
|
23
|
+
Or install the OpenClaw plugin from npm:
|
|
104
24
|
|
|
105
25
|
```bash
|
|
106
|
-
|
|
107
|
-
./scripts/install.sh
|
|
26
|
+
npx openclaw-smart install
|
|
108
27
|
```
|
|
109
28
|
|
|
110
|
-
|
|
29
|
+
The unscoped `openclaw-smart` npm package is a thin `npx` alias around the
|
|
30
|
+
scoped plugin package, `@reflexioai/openclaw-smart`.
|
|
111
31
|
|
|
112
|
-
|
|
32
|
+
If your OpenClaw version supports npm package specs in its plugin installer,
|
|
33
|
+
you can also use the native installer directly:
|
|
113
34
|
|
|
114
35
|
```bash
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
36
|
+
openclaw plugins install @reflexioai/openclaw-smart
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The guided `reflexio setup openclaw` command walks you through:
|
|
40
|
+
|
|
41
|
+
1. Picking an LLM provider and storage backend (SQLite by default).
|
|
42
|
+
2. Writing `OPENCLAW_BIN` + `OPENCLAW_SMART_USE_LOCAL_CLI=1` to
|
|
43
|
+
`~/.reflexio/.env` so the backend's `openclaw` LiteLLM provider knows
|
|
44
|
+
which CLI to spawn for extraction.
|
|
45
|
+
3. Installing the bundled plugin into openClaw
|
|
46
|
+
(`openclaw plugins install <plugin_dir>`).
|
|
47
|
+
4. Running the plugin's first-run installer (`scripts/smart-install.sh`)
|
|
48
|
+
so the next session doesn't pay a cold-install cost.
|
|
49
|
+
5. Calling `openclaw plugins inspect reflexio-openclaw-smart` to verify
|
|
50
|
+
the plugin loaded.
|
|
51
|
+
|
|
52
|
+
`reflexio setup openclaw --uninstall [--purge]` reverses everything;
|
|
53
|
+
`--repair` re-runs only the first-run installer. The npm wrapper exposes
|
|
54
|
+
the same maintenance operations as `openclaw-smart uninstall [--purge]`
|
|
55
|
+
and `openclaw-smart repair`.
|
|
56
|
+
|
|
57
|
+
## How it works
|
|
58
|
+
|
|
59
|
+
* **session_start** — pushes openclaw-smart's preferred extraction window /
|
|
60
|
+
stride and the shared-skill optimizer defaults to the reflexio backend.
|
|
61
|
+
Emits a stall banner (`prependContext`) if learning has been idle.
|
|
62
|
+
* **before_prompt_build** — appends the user prompt to the session JSONL
|
|
63
|
+
buffer, then runs an `/api/search` query against reflexio scoped to this
|
|
64
|
+
project. Top hits are rendered as markdown and emitted under
|
|
65
|
+
`prependContext` (per-turn, not cached).
|
|
66
|
+
* **before_tool_call / after_tool_call** — `before_*` is an observe-only
|
|
67
|
+
stub (openClaw does not honor injection at that point). `after_*`
|
|
68
|
+
redacts secrets, truncates oversized strings, normalizes camelCase
|
|
69
|
+
payloads to snake_case, and appends an `Assistant_tool` record.
|
|
70
|
+
* **agent_end** — reads `payload["messages"]`, appends the latest
|
|
71
|
+
assistant turn, then publishes everything since the last
|
|
72
|
+
`published_up_to` watermark (no force-extraction).
|
|
73
|
+
* **session_end** — drains the buffer one last time with
|
|
74
|
+
`force_extraction=True` so the session's learnings are available before
|
|
75
|
+
the next openClaw run.
|
|
76
|
+
|
|
77
|
+
The full design lives in
|
|
78
|
+
[`docs/superpowers/specs/2026-05-19-openclaw-smart-design.md`](../../../../docs/superpowers/specs/2026-05-19-openclaw-smart-design.md).
|
|
79
|
+
|
|
80
|
+
## Skills
|
|
81
|
+
|
|
82
|
+
Six skill folders ship under `plugin/skills/` (`reflexio` is the always-on contract, the other five are user-invocable):
|
|
83
|
+
|
|
84
|
+
| Skill | Purpose |
|
|
85
|
+
| ----------- | -------------------------------------------------------------------------- |
|
|
86
|
+
| `reflexio` | Always-on contract: trust injected context, cite with `[oc:…]`, stay quiet |
|
|
87
|
+
| `learn` | Force-publish the current session for immediate extraction |
|
|
88
|
+
| `show` | Dump currently-known skills + preferences for this project as markdown |
|
|
89
|
+
| `dashboard` | Open the local reflexio web UI (`http://localhost:3001`, shared with claude-smart) |
|
|
90
|
+
| `restart` | Restart the local reflexio backend cleanly |
|
|
91
|
+
| `clear-all` | Delete all locally-stored skills + preferences (destructive, prompts) |
|
|
138
92
|
|
|
139
93
|
## Configuration
|
|
140
94
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
│ │ ├── handler.ts ← Core hook logic (bootstrap, message events, command:stop)
|
|
200
|
-
│ │ └── setup.ts ← First-use setup (CLI install, storage config)
|
|
201
|
-
│ ├── skills/ ← Agent instruction and tooling
|
|
202
|
-
│ │ └── reflexio/
|
|
203
|
-
│ │ └── SKILL.md ← Teaches agent when/how to search and publish
|
|
204
|
-
│ ├── rules/ ← Always-active behavioral constraints
|
|
205
|
-
│ │ └── reflexio.md ← Follow injected context, manual fallback, transparency
|
|
206
|
-
│ └── index.ts ← Plugin entry point (SDK registration)
|
|
207
|
-
├── hook/ ← Flat hook for manual installation
|
|
208
|
-
│ ├── handler.ts ← Same as plugin/hook/handler.ts
|
|
209
|
-
│ └── HOOK.md ← Hook metadata (see references/HOOK.md)
|
|
210
|
-
├── scripts/ ← Installation and uninstall
|
|
211
|
-
│ ├── install.sh ← Plugin installation
|
|
212
|
-
│ └── uninstall.sh ← Plugin removal (preserves user data)
|
|
213
|
-
└── _old/ ← Legacy documentation and code (to be removed)
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
## Comparison with openclaw-embedded
|
|
217
|
-
|
|
218
|
-
| Aspect | openclaw (federated) | openclaw-embedded |
|
|
219
|
-
| -------------------- | ---------------------------------------- | --------------------------------------- |
|
|
220
|
-
| Architecture | Federated (server-based) | Standalone (no server) |
|
|
221
|
-
| Storage | Reflexio server + SQLite buffer | Local SQLite only |
|
|
222
|
-
| Multi-user support | Yes — per-agentId user isolation | Single user per instance |
|
|
223
|
-
| Cross-instance sync | Yes — via agent playbooks aggregation | No — isolated per instance |
|
|
224
|
-
| Prerequisites | Reflexio CLI, LLM API key, Node.js | SQLite (no server, no API key needed) |
|
|
225
|
-
| Best for | Teams, multiple agents, persistent core | Single agent, offline-first, lightweight |
|
|
226
|
-
| Deployment | Reflexio server + OpenClaw agents | Standalone OpenClaw agent |
|
|
227
|
-
|
|
228
|
-
**Use the federated plugin if:**
|
|
229
|
-
- Multiple agents run on the same machine or team (shared learnings via aggregation)
|
|
230
|
-
- Corrections from one agent should propagate to others
|
|
231
|
-
- A persistent Reflexio server is acceptable
|
|
232
|
-
|
|
233
|
-
**Use openclaw-embedded if:**
|
|
234
|
-
- Single agent, offline-first operation required
|
|
235
|
-
- No external dependencies or API keys
|
|
236
|
-
- Lightweight, self-contained setup
|
|
237
|
-
|
|
238
|
-
## Uninstall
|
|
239
|
-
|
|
240
|
-
### Remove the plugin
|
|
241
|
-
|
|
242
|
-
```bash
|
|
243
|
-
./scripts/uninstall.sh
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
This removes the plugin from OpenClaw, cleans up state files, and preserves user data in `~/.reflexio/`.
|
|
247
|
-
|
|
248
|
-
### Remove user data (optional)
|
|
249
|
-
|
|
250
|
-
```bash
|
|
251
|
-
./scripts/uninstall.sh --purge
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
This also deletes `~/.reflexio/` entirely.
|
|
255
|
-
|
|
256
|
-
### Verify removal
|
|
257
|
-
|
|
258
|
-
```bash
|
|
259
|
-
openclaw plugins list
|
|
260
|
-
# Should not show reflexio-federated
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
## Manual Testing
|
|
264
|
-
|
|
265
|
-
See [TESTING.md](TESTING.md) for a complete step-by-step manual testing guide covering:
|
|
266
|
-
- Install verification
|
|
267
|
-
- First-session auto-setup
|
|
268
|
-
- Search injection
|
|
269
|
-
- Conversation capture and publish
|
|
270
|
-
- `reflexio_publish` tool usage
|
|
271
|
-
- Cross-session retry
|
|
272
|
-
- Multi-user isolation
|
|
273
|
-
- Graceful degradation
|
|
274
|
-
- Uninstall
|
|
95
|
+
Plugin-side config lives in `plugin/openclaw.plugin.json` (no env vars
|
|
96
|
+
required for normal use). The shell scripts honour these env knobs:
|
|
97
|
+
|
|
98
|
+
* `OPENCLAW_SMART_INTERNAL=1` — recursion guard. Set automatically by
|
|
99
|
+
`openclaw_provider._call_cli` when the reflexio backend's own
|
|
100
|
+
LiteLLM-routed extraction subprocess fires hooks back into openclaw-smart.
|
|
101
|
+
Any handler that sees this env in the payload short-circuits.
|
|
102
|
+
* `OPENCLAW_SMART_USE_LOCAL_CLI=1` — opt-in for the
|
|
103
|
+
`openclaw_provider` LiteLLM plugin on the reflexio side. Set by
|
|
104
|
+
`reflexio setup openclaw`.
|
|
105
|
+
* `OPENCLAW_BIN` — absolute path to the openclaw CLI used by the local
|
|
106
|
+
LLM provider. Set by `reflexio setup openclaw`.
|
|
107
|
+
* `OPENCLAW_DEFAULT_MODEL` — default model passed to
|
|
108
|
+
`openclaw infer model run` when no model is requested explicitly.
|
|
109
|
+
* `OPENCLAW_SMART_STATE_DIR` — overrides the JSONL session buffer
|
|
110
|
+
location (default `~/.openclaw-smart/sessions/`). Used by tests.
|
|
111
|
+
* `OPENCLAW_SMART_BACKEND_AUTOSTART=0` — opt out of the
|
|
112
|
+
`session_start` backend auto-start.
|
|
113
|
+
* `OPENCLAW_PLUGIN_ROOT` — pointer used by slash commands;
|
|
114
|
+
`scripts/ensure-plugin-root.sh` symlinks `~/.reflexio/openclaw-plugin-root`
|
|
115
|
+
to the active install.
|
|
116
|
+
|
|
117
|
+
## Recursion guard
|
|
118
|
+
|
|
119
|
+
The reflexio backend uses `openclaw_provider` (a LiteLLM CustomLLM) to
|
|
120
|
+
invoke the openclaw CLI for extraction. That CLI can in turn fire openClaw
|
|
121
|
+
hooks back into openclaw-smart, which would re-publish the extractor's
|
|
122
|
+
own prompt into reflexio — a tight feedback loop that explodes the
|
|
123
|
+
buffer. The guard at `openclaw_smart.internal_call.is_internal_invocation`
|
|
124
|
+
detects this by:
|
|
125
|
+
|
|
126
|
+
1. checking `OPENCLAW_SMART_INTERNAL=1` (set by the provider on spawn),
|
|
127
|
+
2. checking whether `workspaceDir` lives inside the reflexio install dir.
|
|
128
|
+
|
|
129
|
+
When either is true the hook dispatcher exits with empty stdout
|
|
130
|
+
immediately — no buffer writes, no search, no publish.
|
|
131
|
+
|
|
132
|
+
## Multi-session limitation
|
|
133
|
+
|
|
134
|
+
The TS shim tracks one `activeSessionKey` per plugin instance to route
|
|
135
|
+
the `reflexio_publish` tool to the right session. In concurrent
|
|
136
|
+
multi-session use the last session-key seen wins. This matches
|
|
137
|
+
claude-smart's behaviour and is intentional — see spec §10.
|
|
138
|
+
|
|
139
|
+
## Troubleshooting
|
|
140
|
+
|
|
141
|
+
* **Hook timing out / no inject** — check
|
|
142
|
+
`~/.openclaw-smart/backend.log` for reflexio startup errors. The
|
|
143
|
+
session-start backend autostart is best-effort; you can also start it
|
|
144
|
+
manually via `bash plugin/scripts/backend-service.sh start`.
|
|
145
|
+
* **`uv` not found** — re-run `bash plugin/scripts/smart-install.sh`; on
|
|
146
|
+
failure it writes the reason to `~/.openclaw-smart/install-failed`.
|
|
147
|
+
* **Stale plugin after a code change** — `reflexio setup openclaw --repair`
|
|
148
|
+
re-runs the first-run installer and clears the failure marker.
|
|
149
|
+
* **Recursion loop / sessions multiplying** — the extractor lost the
|
|
150
|
+
`OPENCLAW_SMART_INTERNAL=1` env. Confirm `openclaw_provider._call_cli`
|
|
151
|
+
is still passing it (see
|
|
152
|
+
`reflexio/server/llm/providers/openclaw_provider.py`).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Unscoped npm alias for `npx openclaw-smart install`.
|
|
3
|
+
|
|
4
|
+
import { spawnSync } from "node:child_process";
|
|
5
|
+
import { createRequire } from "node:module";
|
|
6
|
+
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
const cli = require.resolve("@reflexioai/openclaw-smart/scripts/npm-cli.js");
|
|
9
|
+
const result = spawnSync(process.execPath, [cli, ...process.argv.slice(2)], {
|
|
10
|
+
stdio: "inherit",
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
process.exit(result.status ?? 1);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "openclaw-smart",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "npx installer alias for @reflexioai/openclaw-smart.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"openclaw-smart": "./bin/openclaw-smart.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin/**/*.js"
|
|
11
|
+
],
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@reflexioai/openclaw-smart": "0.1.0"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# openclaw-smart
|
|
2
|
+
|
|
3
|
+
openClaw plugin: cross-session memory via a local Reflexio backend.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx openclaw-smart install
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The unscoped `openclaw-smart` package is a thin alias for this scoped plugin
|
|
12
|
+
package, `@reflexioai/openclaw-smart`.
|
|
13
|
+
|
|
14
|
+
If your OpenClaw version supports npm package specs in `plugins install`, you
|
|
15
|
+
can install the plugin package directly:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
openclaw plugins install @reflexioai/openclaw-smart
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
For users who already have Reflexio installed, the guided setup remains:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
reflexio setup openclaw
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Commands
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
openclaw-smart install
|
|
31
|
+
openclaw-smart repair
|
|
32
|
+
openclaw-smart uninstall
|
|
33
|
+
openclaw-smart uninstall --purge
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`install` registers `reflexio-openclaw-smart` with OpenClaw, enables typed hook
|
|
37
|
+
access, writes `OPENCLAW_BIN` and `OPENCLAW_SMART_USE_LOCAL_CLI=1` to
|
|
38
|
+
`~/.reflexio/.env`, warms Python dependencies, and verifies the plugin is loaded.
|