claude-smart 0.2.42 → 0.2.44
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 +1 -1
- package/bin/claude-smart.js +2 -2
- package/package.json +9 -3
- package/plugin/.claude-plugin/plugin.json +9 -3
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/README.md +23 -3
- package/plugin/pyproject.toml +3 -3
- package/plugin/scripts/_lib.sh +91 -0
- package/plugin/scripts/backend-service.sh +51 -4
- package/plugin/scripts/cli.sh +3 -1
- package/plugin/scripts/codex-hook.js +72 -4
- package/plugin/scripts/dashboard-build.sh +1 -0
- package/plugin/scripts/dashboard-service.sh +1 -0
- package/plugin/scripts/ensure-plugin-root.sh +1 -0
- package/plugin/scripts/hook_entry.sh +6 -3
- package/plugin/scripts/smart-install.sh +3 -2
- package/plugin/src/README.md +57 -0
- package/plugin/src/claude_smart/context_format.py +11 -12
- package/plugin/src/claude_smart/cs_cite.py +26 -12
- package/plugin/src/claude_smart/ids.py +13 -5
- package/plugin/uv.lock +126 -5
- package/plugin/vendor/reflexio/.env.example +62 -0
- package/plugin/vendor/reflexio/LICENSE +201 -0
- package/plugin/vendor/reflexio/README.md +338 -0
- package/plugin/vendor/reflexio/pyproject.toml +274 -0
- package/plugin/vendor/reflexio/reflexio/README.md +184 -0
- package/plugin/vendor/reflexio/reflexio/__init__.py +166 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/__init__.py +1 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/README.md +109 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/__init__.py +1 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/backends.py +175 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/bench.py +642 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/embed_cache.py +330 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/report.py +317 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/results/report.md +43 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/results/results.json +4478 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/scenarios.py +134 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/seed.py +255 -0
- package/plugin/vendor/reflexio/reflexio/cli/README.md +287 -0
- package/plugin/vendor/reflexio/reflexio/cli/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/cli/__main__.py +56 -0
- package/plugin/vendor/reflexio/reflexio/cli/_client.py +86 -0
- package/plugin/vendor/reflexio/reflexio/cli/app.py +127 -0
- package/plugin/vendor/reflexio/reflexio/cli/bootstrap_config.py +265 -0
- package/plugin/vendor/reflexio/reflexio/cli/codex_auth.py +503 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/admin_cmd.py +65 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/agent_playbooks.py +503 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/api.py +114 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/auth.py +109 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/config_cmd.py +511 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/doctor.py +127 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/embeddings.py +53 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/interactions.py +478 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/profiles.py +303 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/services.py +289 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/setup_cmd.py +964 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/shortcuts.py +285 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/status_cmd.py +143 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/user_playbooks.py +373 -0
- package/plugin/vendor/reflexio/reflexio/cli/env_loader.py +284 -0
- package/plugin/vendor/reflexio/reflexio/cli/errors.py +217 -0
- package/plugin/vendor/reflexio/reflexio/cli/log_format.py +247 -0
- package/plugin/vendor/reflexio/reflexio/cli/output.py +867 -0
- package/plugin/vendor/reflexio/reflexio/cli/paths.py +41 -0
- package/plugin/vendor/reflexio/reflexio/cli/run_services.py +391 -0
- package/plugin/vendor/reflexio/reflexio/cli/state.py +204 -0
- package/plugin/vendor/reflexio/reflexio/cli/stop_services.py +96 -0
- package/plugin/vendor/reflexio/reflexio/cli/utils.py +329 -0
- package/plugin/vendor/reflexio/reflexio/client/__init__.py +3 -0
- package/plugin/vendor/reflexio/reflexio/client/cache.py +150 -0
- package/plugin/vendor/reflexio/reflexio/client/client.py +2613 -0
- package/plugin/vendor/reflexio/reflexio/defaults.py +23 -0
- package/plugin/vendor/reflexio/reflexio/integrations/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/.clawhubignore +7 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/README.md +274 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/TESTING.md +517 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/hook/handler.js +473 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/package-lock.json +2156 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/package.json +18 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/hook/handler.ts +241 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/hook/setup.ts +140 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/index.ts +130 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/publish.ts +113 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/search.ts +52 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/server.ts +103 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/sqlite-buffer.ts +156 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/user-id.ts +134 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/openclaw.plugin.json +41 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/package.json +17 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/rules/reflexio.md +24 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/skills/reflexio/SKILL.md +48 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/publish_clawhub.sh +278 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/references/HOOK.md +164 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/scripts/install.sh +36 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/scripts/uninstall.sh +35 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/publish.test.ts +27 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/search.test.ts +31 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/server.test.ts +42 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/setup.test.ts +49 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/sqlite-buffer.test.ts +91 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/user-id.test.ts +50 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tsconfig.json +16 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/types/openclaw.d.ts +230 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/vitest.config.ts +13 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/README.md +120 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/TESTING.md +168 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/package-lock.json +1657 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/package.json +16 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/HEARTBEAT.md +6 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/README.md +84 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/SKILL.md +194 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/_meta.json +6 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/agents/reflexio-extractor.md +45 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/hook/handler.ts +214 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/hook/setup.ts +55 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/index.ts +327 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/consolidate.ts +233 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/dedup.ts +80 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/io.ts +155 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/openclaw-cli.ts +67 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/search.ts +33 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/write-playbook.ts +76 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/write-profile.ts +79 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/openclaw.plugin.json +46 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/package.json +18 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/prompts/README.md +36 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/prompts/full_consolidation.md +56 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/prompts/playbook_extraction.md +217 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/prompts/profile_extraction.md +132 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/skills/reflexio-consolidate/SKILL.md +33 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/skills/reflexio-embedded/SKILL.md +194 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/references/HOOK.md +18 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/references/architecture.md +49 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/references/comparison.md +31 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/references/future-work.md +47 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/references/porting-notes.md +52 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/scripts/install.sh +52 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/scripts/uninstall.sh +36 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/consolidate.test.ts +135 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/dedup.test.ts +104 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/io.test.ts +175 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/search.test.ts +66 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/smoke-test.ts +140 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/write-playbook.test.ts +93 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/write-profile.test.ts +174 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tsconfig.json +16 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/types/openclaw.d.ts +230 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/vitest.config.ts +7 -0
- package/plugin/vendor/reflexio/reflexio/lib/__init__.py +23 -0
- package/plugin/vendor/reflexio/reflexio/lib/_agent_playbook.py +310 -0
- package/plugin/vendor/reflexio/reflexio/lib/_base.py +225 -0
- package/plugin/vendor/reflexio/reflexio/lib/_config.py +83 -0
- package/plugin/vendor/reflexio/reflexio/lib/_dashboard.py +266 -0
- package/plugin/vendor/reflexio/reflexio/lib/_generation.py +176 -0
- package/plugin/vendor/reflexio/reflexio/lib/_interactions.py +334 -0
- package/plugin/vendor/reflexio/reflexio/lib/_operations.py +153 -0
- package/plugin/vendor/reflexio/reflexio/lib/_profiles.py +545 -0
- package/plugin/vendor/reflexio/reflexio/lib/_reflection.py +52 -0
- package/plugin/vendor/reflexio/reflexio/lib/_search.py +167 -0
- package/plugin/vendor/reflexio/reflexio/lib/_storage_labels.py +103 -0
- package/plugin/vendor/reflexio/reflexio/lib/_user_playbook.py +288 -0
- package/plugin/vendor/reflexio/reflexio/lib/reflexio_lib.py +27 -0
- package/plugin/vendor/reflexio/reflexio/models/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/braintrust_schema.py +141 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/common.py +41 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/domain/__init__.py +3 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/domain/entities.py +1112 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/domain/enums.py +63 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/eval_overview_schema.py +487 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/internal_schema.py +28 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/pending_tool_call_schema.py +83 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/retriever_schema.py +768 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/service_schemas.py +9 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/stall_state_schema.py +32 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/ui/__init__.py +3 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/ui/converters.py +177 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/ui/entities.py +129 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/ui/enums.py +25 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/validators.py +333 -0
- package/plugin/vendor/reflexio/reflexio/models/config_schema.py +908 -0
- package/plugin/vendor/reflexio/reflexio/models/py.typed +0 -0
- package/plugin/vendor/reflexio/reflexio/server/OVERVIEW.md +90 -0
- package/plugin/vendor/reflexio/reflexio/server/README.md +622 -0
- package/plugin/vendor/reflexio/reflexio/server/__init__.py +210 -0
- package/plugin/vendor/reflexio/reflexio/server/__main__.py +132 -0
- package/plugin/vendor/reflexio/reflexio/server/_auth.py +25 -0
- package/plugin/vendor/reflexio/reflexio/server/api.py +2868 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/README.md +34 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/account_api.py +143 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/health_api.py +91 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/pending_tool_call_api.py +572 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/precondition_checks.py +66 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/publisher_api.py +562 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/request_context.py +50 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/stall_state_api.py +100 -0
- package/plugin/vendor/reflexio/reflexio/server/cache/__init__.py +15 -0
- package/plugin/vendor/reflexio/reflexio/server/cache/reflexio_cache.py +208 -0
- package/plugin/vendor/reflexio/reflexio/server/correlation.py +46 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/__init__.py +30 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/embedding_service.py +359 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/image_utils.py +55 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/litellm_client.py +1871 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/llm_utils.py +140 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/model_defaults.py +479 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/__init__.py +1 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/claude_code_provider.py +1122 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/claude_code_stream_parser.py +197 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/embedding_service_provider.py +338 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/local_embedding_provider.py +213 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/nomic_embedding_provider.py +288 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/rerank/__init__.py +6 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/rerank/cross_encoder_reranker.py +187 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/rerank/llm_reranker.py +148 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/tools.py +716 -0
- package/plugin/vendor/reflexio/reflexio/server/operation_limiter.py +179 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/_dispatchers.py +54 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/README.md +121 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/agent_success_evaluation/v1.0.0.prompt.md +58 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/agent_success_evaluation_with_comparison/v1.0.0.prompt.md +76 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/answer_synthesis/v1.5.2.prompt.md +88 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/compress_session_for_query/v1.3.0.prompt.md +31 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/document_expansion/v1.0.0.prompt.md +20 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.0.0.prompt.md +53 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.1.0.prompt.md +57 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.2.0.prompt.md +68 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.3.0.prompt.md +70 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.4.0.prompt.md +77 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.5.0.prompt.md +82 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.6.0.prompt.md +83 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_aggregation/v2.1.0.prompt.md +193 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_aggregation/v2.2.0.prompt.md +206 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v1.0.0-deprecated.prompt.md +66 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v1.0.0.prompt.md +43 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v1.1.0.prompt.md +46 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.0.0-deprecated.prompt.md +64 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.0.0.prompt.md +39 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.1.0.prompt.md +39 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.2.0.prompt.md +47 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.3.0.prompt.md +58 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.3.1.prompt.md +69 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.3.2.prompt.md +71 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.0.2.prompt.md +254 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.1.0.prompt.md +274 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.2.0.prompt.md +283 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.2.2.prompt.md +234 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.2.3.prompt.md +244 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v1.0.0.prompt.md +73 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v2.0.0.prompt.md +86 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v3.0.0.prompt.md +97 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v3.1.0.prompt.md +119 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v3.2.0.prompt.md +123 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v3.3.0.prompt.md +137 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main/v1.0.0.prompt.md +14 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main/v1.1.0.prompt.md +24 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main/v1.2.0.prompt.md +29 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main_expert/v1.0.0.prompt.md +11 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main_expert/v1.1.0.prompt.md +21 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main_expert/v1.2.0.prompt.md +25 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_optimizer_judge/v1.0.0.prompt.md +37 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_optimizer_judge/v1.1.0.prompt.md +40 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_optimizer_judge/v1.2.0.prompt.md +36 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_should_generate/v1.0.0.prompt.md +45 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_should_generate/v2.0.0.prompt.md +81 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_should_generate/v3.0.0.prompt.md +80 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_should_generate_expert/v1.0.0.prompt.md +34 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_deduplication/v1.0.0.prompt.md +116 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_should_generate/v1.0.0.prompt.md +33 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_should_generate_override/v1.0.0.prompt.md +16 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_update_instruction_start/v1.0.0.prompt.md +140 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_update_instruction_start/v1.1.0.prompt.md +160 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_update_main/v1.0.0.prompt.md +14 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/query_reformulation/v1.0.0.prompt.md +19 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/rerank_relevance/v1.1.0.prompt.md +44 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/shadow_comparison/v1.0.0.prompt.md +43 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/shadow_content_evaluation/v1.0.0.prompt.md +33 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_evaluation/prompt_evaluation_dataset/feedback_extraction_main_v1.jsonl +10 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_evaluation/prompt_evaluation_dataset/profile_update_main_v1.jsonl +10 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_manager.py +280 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_schema.py +11 -0
- package/plugin/vendor/reflexio/reflexio/server/services/README.md +58 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/_eval_health.py +131 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/agent_success_evaluation_constants.py +60 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/agent_success_evaluation_service.py +228 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/agent_success_evaluation_utils.py +87 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/agent_success_evaluator.py +372 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/delayed_group_evaluator.py +156 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/group_evaluation_runner.py +336 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/regen_jobs.py +471 -0
- package/plugin/vendor/reflexio/reflexio/server/services/base_generation_service.py +1668 -0
- package/plugin/vendor/reflexio/reflexio/server/services/braintrust/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/services/braintrust/_cron.py +196 -0
- package/plugin/vendor/reflexio/reflexio/server/services/braintrust/_encryption.py +101 -0
- package/plugin/vendor/reflexio/reflexio/server/services/braintrust/client.py +167 -0
- package/plugin/vendor/reflexio/reflexio/server/services/braintrust/service.py +281 -0
- package/plugin/vendor/reflexio/reflexio/server/services/configurator/base_configurator.py +179 -0
- package/plugin/vendor/reflexio/reflexio/server/services/configurator/config_storage.py +62 -0
- package/plugin/vendor/reflexio/reflexio/server/services/configurator/configurator.py +87 -0
- package/plugin/vendor/reflexio/reflexio/server/services/configurator/local_file_config_storage.py +187 -0
- package/plugin/vendor/reflexio/reflexio/server/services/configurator/test_config_storage.py +162 -0
- package/plugin/vendor/reflexio/reflexio/server/services/deduplication_utils.py +112 -0
- package/plugin/vendor/reflexio/reflexio/server/services/embedding_text.py +62 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/distribution.py +33 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/eval_sampler.py +126 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/group_aggregation.py +192 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/hero_state.py +75 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/rule_attribution.py +97 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/service.py +515 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/shadow_aggregation.py +90 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/agent_run_records.py +91 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/invariants.py +303 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/outcome.py +25 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/pending_tool_call_dispatch.py +358 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/plan.py +138 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/prior_answer_search.py +217 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/resumable_agent.py +535 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/resume_scheduler.py +171 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/resume_worker.py +779 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/tools.py +1125 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extractor_config_utils.py +94 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extractor_interaction_utils.py +251 -0
- package/plugin/vendor/reflexio/reflexio/server/services/generation_service.py +702 -0
- package/plugin/vendor/reflexio/reflexio/server/services/operation_state_utils.py +835 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/README.md +89 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_aggregator.py +1388 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_consolidator.py +1045 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_extractor.py +436 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_generation_service.py +808 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_service_constants.py +28 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_service_utils.py +362 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/__init__.py +24 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/assistant_webhook.py +246 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/gepa_adapter.py +291 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/judge.py +97 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/models.py +96 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/optimizer.py +645 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/rollout.py +35 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/scenario_resolver.py +93 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/scheduler.py +174 -0
- package/plugin/vendor/reflexio/reflexio/server/services/pre_retrieval/__init__.py +26 -0
- package/plugin/vendor/reflexio/reflexio/server/services/pre_retrieval/_document_expander.py +179 -0
- package/plugin/vendor/reflexio/reflexio/server/services/pre_retrieval/_query_reformulator.py +297 -0
- package/plugin/vendor/reflexio/reflexio/server/services/profile/profile_deduplicator.py +772 -0
- package/plugin/vendor/reflexio/reflexio/server/services/profile/profile_extractor.py +462 -0
- package/plugin/vendor/reflexio/reflexio/server/services/profile/profile_generation_service.py +737 -0
- package/plugin/vendor/reflexio/reflexio/server/services/profile/profile_generation_service_utils.py +290 -0
- package/plugin/vendor/reflexio/reflexio/server/services/reflection/__init__.py +17 -0
- package/plugin/vendor/reflexio/reflexio/server/services/reflection/reflection_extractor.py +247 -0
- package/plugin/vendor/reflexio/reflexio/server/services/reflection/reflection_service.py +803 -0
- package/plugin/vendor/reflexio/reflexio/server/services/reflection/reflection_service_utils.py +146 -0
- package/plugin/vendor/reflexio/reflexio/server/services/retrieval/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/services/retrieval/relevance_floor.py +80 -0
- package/plugin/vendor/reflexio/reflexio/server/services/search/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/services/service_utils.py +756 -0
- package/plugin/vendor/reflexio/reflexio/server/services/shadow_comparison/__init__.py +1 -0
- package/plugin/vendor/reflexio/reflexio/server/services/shadow_comparison/judge.py +184 -0
- package/plugin/vendor/reflexio/reflexio/server/services/shadow_comparison/outcome.py +81 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/constants.py +2 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/error.py +11 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/retention.py +154 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/retention_mixin.py +155 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/__init__.py +59 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_agent_run.py +1298 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_base.py +1945 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_extras.py +600 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_operations.py +346 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_playbook.py +1378 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_profiles.py +747 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_requests.py +263 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_shadow_verdicts.py +193 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_share_links.py +166 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_stall_state.py +217 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/__init__.py +153 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_agent_run.py +384 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_base.py +71 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_extras.py +235 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_operations.py +170 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_playbook.py +677 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_profiles.py +250 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_requests.py +154 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_shadow_verdicts.py +130 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_share_links.py +93 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_stall_state.py +76 -0
- package/plugin/vendor/reflexio/reflexio/server/services/unified_search_service.py +572 -0
- package/plugin/vendor/reflexio/reflexio/server/site_var/README.md +77 -0
- package/plugin/vendor/reflexio/reflexio/server/site_var/feature_flags.py +116 -0
- package/plugin/vendor/reflexio/reflexio/server/site_var/site_var_manager.py +263 -0
- package/plugin/vendor/reflexio/reflexio/server/site_var/site_var_sources/feature_flags.json +13 -0
- package/plugin/vendor/reflexio/reflexio/server/site_var/site_var_sources/llm_model_setting.json +7 -0
- package/plugin/vendor/reflexio/reflexio/server/tracing.py +158 -0
- package/plugin/vendor/reflexio/reflexio/server/usage_metrics.py +113 -0
- package/plugin/vendor/reflexio/reflexio/server/uvicorn_logging.py +76 -0
- package/plugin/vendor/reflexio/reflexio/test_support/__init__.py +1 -0
- package/plugin/vendor/reflexio/reflexio/test_support/llm_fixtures.py +62 -0
- package/plugin/vendor/reflexio/reflexio/test_support/llm_mock.py +242 -0
- package/plugin/vendor/reflexio/reflexio/test_support/llm_model_registry.py +129 -0
- package/plugin/vendor/reflexio/reflexio/test_support/skip_decorators.py +43 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
2
|
+
import * as fs from "node:fs";
|
|
3
|
+
import * as os from "node:os";
|
|
4
|
+
import * as path from "node:path";
|
|
5
|
+
import {
|
|
6
|
+
openDb,
|
|
7
|
+
insertTurn,
|
|
8
|
+
getUnpublished,
|
|
9
|
+
markInFlight,
|
|
10
|
+
markPublished,
|
|
11
|
+
markFailed,
|
|
12
|
+
smartTruncate,
|
|
13
|
+
cleanupOldTurns,
|
|
14
|
+
} from "../plugin/lib/sqlite-buffer.ts";
|
|
15
|
+
import type Database from "better-sqlite3";
|
|
16
|
+
|
|
17
|
+
describe("smartTruncate", () => {
|
|
18
|
+
it("returns content unchanged when under limit", () => {
|
|
19
|
+
expect(smartTruncate("hello", 100)).toBe("hello");
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("truncates with head + marker + tail within maxLength", () => {
|
|
23
|
+
const content = "a".repeat(200);
|
|
24
|
+
const result = smartTruncate(content, 100);
|
|
25
|
+
expect(result.length).toBeLessThanOrEqual(100);
|
|
26
|
+
expect(result).toContain("[...truncated");
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("returns empty string for empty input", () => {
|
|
30
|
+
expect(smartTruncate("", 100)).toBe("");
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
describe("sqlite-buffer", () => {
|
|
35
|
+
let db: Database.Database;
|
|
36
|
+
let tmpDir: string;
|
|
37
|
+
|
|
38
|
+
beforeEach(() => {
|
|
39
|
+
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "reflexio-test-"));
|
|
40
|
+
const dbPath = path.join(tmpDir, "sessions.db");
|
|
41
|
+
db = openDb(dbPath);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
afterEach(() => {
|
|
45
|
+
db.close();
|
|
46
|
+
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("inserts and retrieves turns", () => {
|
|
50
|
+
insertTurn(db, "sess1", "user", "hello");
|
|
51
|
+
insertTurn(db, "sess1", "assistant", "hi there");
|
|
52
|
+
const turns = getUnpublished(db, "sess1", 3, 100);
|
|
53
|
+
expect(turns).toHaveLength(2);
|
|
54
|
+
expect(turns[0].role).toBe("user");
|
|
55
|
+
expect(turns[1].role).toBe("assistant");
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("marks turns as in-flight then published", () => {
|
|
59
|
+
insertTurn(db, "sess1", "user", "hello");
|
|
60
|
+
const turns = getUnpublished(db, "sess1", 3, 100);
|
|
61
|
+
const maxId = turns[turns.length - 1].id;
|
|
62
|
+
markInFlight(db, "sess1", maxId, 3);
|
|
63
|
+
expect(getUnpublished(db, "sess1", 3, 100)).toHaveLength(0);
|
|
64
|
+
markPublished(db, "sess1", maxId);
|
|
65
|
+
expect(getUnpublished(db, "sess1", 3, 100)).toHaveLength(0);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("increments retry count on failure", () => {
|
|
69
|
+
insertTurn(db, "sess1", "user", "hello");
|
|
70
|
+
const turns = getUnpublished(db, "sess1", 3, 100);
|
|
71
|
+
const id = turns[0].id;
|
|
72
|
+
markInFlight(db, "sess1", id, 3);
|
|
73
|
+
markFailed(db, "sess1", id);
|
|
74
|
+
const after = getUnpublished(db, "sess1", 3, 100);
|
|
75
|
+
expect(after).toHaveLength(1);
|
|
76
|
+
// After MAX_RETRIES failures, turn should be excluded
|
|
77
|
+
markInFlight(db, "sess1", id, 3);
|
|
78
|
+
markFailed(db, "sess1", id);
|
|
79
|
+
markInFlight(db, "sess1", id, 3);
|
|
80
|
+
markFailed(db, "sess1", id);
|
|
81
|
+
expect(getUnpublished(db, "sess1", 3, 100)).toHaveLength(0);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it("respects max interactions limit", () => {
|
|
85
|
+
for (let i = 0; i < 10; i++) {
|
|
86
|
+
insertTurn(db, "sess1", "user", `msg ${i}`);
|
|
87
|
+
}
|
|
88
|
+
const turns = getUnpublished(db, "sess1", 3, 5);
|
|
89
|
+
expect(turns).toHaveLength(5);
|
|
90
|
+
});
|
|
91
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
|
2
|
+
import { resolveUserId, stripJsonComments, _resetCache } from "../plugin/lib/user-id.ts";
|
|
3
|
+
|
|
4
|
+
describe("stripJsonComments", () => {
|
|
5
|
+
it("strips line comments", () => {
|
|
6
|
+
expect(stripJsonComments('{ "key": "val" } // comment')).toBe('{ "key": "val" } ');
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it("preserves URLs in quoted strings", () => {
|
|
10
|
+
expect(stripJsonComments('{ "url": "http://example.com" }')).toBe(
|
|
11
|
+
'{ "url": "http://example.com" }',
|
|
12
|
+
);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it("strips comment after quoted string containing //", () => {
|
|
16
|
+
expect(stripJsonComments('{ "url": "http://x.com" } // note')).toBe(
|
|
17
|
+
'{ "url": "http://x.com" } ',
|
|
18
|
+
);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
describe("resolveUserId", () => {
|
|
23
|
+
const originalEnv = process.env;
|
|
24
|
+
|
|
25
|
+
beforeEach(() => {
|
|
26
|
+
process.env = { ...originalEnv };
|
|
27
|
+
_resetCache();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
afterEach(() => {
|
|
31
|
+
process.env = originalEnv;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("returns REFLEXIO_USER_ID env var if set", () => {
|
|
35
|
+
process.env.REFLEXIO_USER_ID = "custom-user";
|
|
36
|
+
expect(resolveUserId("agent:main:abc123")).toBe("custom-user");
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("extracts agentId from session key format agent:<id>:<key>", () => {
|
|
40
|
+
expect(resolveUserId("agent:work:session789")).toBe("work");
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("falls back to 'openclaw' when no session key or env", () => {
|
|
44
|
+
expect(resolveUserId("")).toBe("openclaw");
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("falls back to 'openclaw' for non-agent session key format", () => {
|
|
48
|
+
expect(resolveUserId("random-session-key")).toBe("openclaw");
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"noEmit": true,
|
|
10
|
+
"allowImportingTsExtensions": true,
|
|
11
|
+
"resolveJsonModule": true,
|
|
12
|
+
"types": ["node"]
|
|
13
|
+
},
|
|
14
|
+
"include": ["plugin/**/*.ts", "types/**/*.d.ts"],
|
|
15
|
+
"exclude": ["tests", "node_modules"]
|
|
16
|
+
}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
// Narrow ambient shim for the Openclaw Plugin SDK surface that this plugin
|
|
2
|
+
// actually touches. The real types ship with the `openclaw` npm package, but
|
|
3
|
+
// we avoid depending on the full host at build time — plugins load at runtime
|
|
4
|
+
// via the host's own jiti instance.
|
|
5
|
+
//
|
|
6
|
+
// If you need richer type coverage, install `openclaw` as a devDependency and
|
|
7
|
+
// delete this file; the real .d.ts files will take over.
|
|
8
|
+
declare module "openclaw/plugin-sdk/plugin-entry" {
|
|
9
|
+
export type PluginHookName =
|
|
10
|
+
| "before_model_resolve"
|
|
11
|
+
| "before_prompt_build"
|
|
12
|
+
| "before_agent_start"
|
|
13
|
+
| "before_agent_reply"
|
|
14
|
+
| "llm_input"
|
|
15
|
+
| "llm_output"
|
|
16
|
+
| "agent_end"
|
|
17
|
+
| "before_compaction"
|
|
18
|
+
| "after_compaction"
|
|
19
|
+
| "before_reset"
|
|
20
|
+
| "inbound_claim"
|
|
21
|
+
| "message_received"
|
|
22
|
+
| "message_sending"
|
|
23
|
+
| "message_sent"
|
|
24
|
+
| "before_tool_call"
|
|
25
|
+
| "after_tool_call"
|
|
26
|
+
| "tool_result_persist"
|
|
27
|
+
| "before_message_write"
|
|
28
|
+
| "session_start"
|
|
29
|
+
| "session_end"
|
|
30
|
+
| "subagent_spawning"
|
|
31
|
+
| "subagent_delivery_target"
|
|
32
|
+
| "subagent_spawned"
|
|
33
|
+
| "subagent_ended"
|
|
34
|
+
| "gateway_start"
|
|
35
|
+
| "gateway_stop"
|
|
36
|
+
| "before_dispatch"
|
|
37
|
+
| "reply_dispatch"
|
|
38
|
+
| "before_install";
|
|
39
|
+
|
|
40
|
+
export type PluginLogger = {
|
|
41
|
+
info?: (msg: string) => void;
|
|
42
|
+
warn?: (msg: string) => void;
|
|
43
|
+
error?: (msg: string) => void;
|
|
44
|
+
debug?: (msg: string) => void;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type PluginRuntime = {
|
|
48
|
+
subagent?: {
|
|
49
|
+
run: (params: {
|
|
50
|
+
sessionKey: string;
|
|
51
|
+
message: string;
|
|
52
|
+
provider?: string;
|
|
53
|
+
model?: string;
|
|
54
|
+
extraSystemPrompt?: string;
|
|
55
|
+
lane?: string;
|
|
56
|
+
deliver?: boolean;
|
|
57
|
+
idempotencyKey?: string;
|
|
58
|
+
}) => Promise<{ runId: string }>;
|
|
59
|
+
};
|
|
60
|
+
system: {
|
|
61
|
+
runCommandWithTimeout: (
|
|
62
|
+
argv: string[],
|
|
63
|
+
opts: { timeoutMs: number; input?: string },
|
|
64
|
+
) => Promise<{ stdout: string; stderr: string; code: number | null }>;
|
|
65
|
+
};
|
|
66
|
+
config: {
|
|
67
|
+
loadConfig: () => unknown;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export type PluginHookAgentContext = {
|
|
72
|
+
runId?: string;
|
|
73
|
+
agentId?: string;
|
|
74
|
+
sessionKey?: string;
|
|
75
|
+
sessionId?: string;
|
|
76
|
+
workspaceDir?: string;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export type PluginHookSessionContext = {
|
|
80
|
+
agentId?: string;
|
|
81
|
+
sessionId: string;
|
|
82
|
+
sessionKey?: string;
|
|
83
|
+
workspaceDir?: string;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export type PluginHookBeforeAgentStartEvent = {
|
|
87
|
+
prompt: string;
|
|
88
|
+
messages?: unknown[];
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export type PluginHookBeforeAgentStartResult = {
|
|
92
|
+
prependSystemContext?: string;
|
|
93
|
+
systemPrompt?: string;
|
|
94
|
+
prependContext?: string;
|
|
95
|
+
appendSystemContext?: string;
|
|
96
|
+
modelOverride?: string;
|
|
97
|
+
providerOverride?: string;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export type PluginHookBeforeCompactionEvent = {
|
|
101
|
+
messageCount: number;
|
|
102
|
+
compactingCount?: number;
|
|
103
|
+
tokenCount?: number;
|
|
104
|
+
messages?: unknown[];
|
|
105
|
+
sessionFile?: string;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export type PluginHookBeforeResetEvent = {
|
|
109
|
+
sessionFile?: string;
|
|
110
|
+
messages?: unknown[];
|
|
111
|
+
reason?: string;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export type PluginHookSessionEndEvent = {
|
|
115
|
+
sessionId: string;
|
|
116
|
+
sessionKey?: string;
|
|
117
|
+
messageCount: number;
|
|
118
|
+
durationMs?: number;
|
|
119
|
+
reason?: string;
|
|
120
|
+
sessionFile?: string;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export type OpenClawPluginApi = {
|
|
124
|
+
id: string;
|
|
125
|
+
name: string;
|
|
126
|
+
runtime: PluginRuntime;
|
|
127
|
+
logger: PluginLogger;
|
|
128
|
+
pluginConfig?: Record<string, unknown>;
|
|
129
|
+
registerTool: (tool: {
|
|
130
|
+
name: string;
|
|
131
|
+
description: string;
|
|
132
|
+
parameters: Record<string, unknown>;
|
|
133
|
+
optional?: boolean;
|
|
134
|
+
execute: (id: string, params: Record<string, unknown>) => Promise<{
|
|
135
|
+
content: { type: string; text: string }[];
|
|
136
|
+
}>;
|
|
137
|
+
}) => void;
|
|
138
|
+
on: {
|
|
139
|
+
(
|
|
140
|
+
hookName: "before_agent_start",
|
|
141
|
+
handler: (
|
|
142
|
+
event: PluginHookBeforeAgentStartEvent,
|
|
143
|
+
ctx: PluginHookAgentContext,
|
|
144
|
+
) =>
|
|
145
|
+
| Promise<PluginHookBeforeAgentStartResult | void>
|
|
146
|
+
| PluginHookBeforeAgentStartResult
|
|
147
|
+
| void,
|
|
148
|
+
opts?: { priority?: number },
|
|
149
|
+
): void;
|
|
150
|
+
(
|
|
151
|
+
hookName: "before_compaction",
|
|
152
|
+
handler: (
|
|
153
|
+
event: PluginHookBeforeCompactionEvent,
|
|
154
|
+
ctx: PluginHookAgentContext,
|
|
155
|
+
) => Promise<void> | void,
|
|
156
|
+
opts?: { priority?: number },
|
|
157
|
+
): void;
|
|
158
|
+
(
|
|
159
|
+
hookName: "before_reset",
|
|
160
|
+
handler: (
|
|
161
|
+
event: PluginHookBeforeResetEvent,
|
|
162
|
+
ctx: PluginHookAgentContext,
|
|
163
|
+
) => Promise<void> | void,
|
|
164
|
+
opts?: { priority?: number },
|
|
165
|
+
): void;
|
|
166
|
+
(
|
|
167
|
+
hookName: "session_end",
|
|
168
|
+
handler: (
|
|
169
|
+
event: PluginHookSessionEndEvent,
|
|
170
|
+
ctx: PluginHookSessionContext,
|
|
171
|
+
) => Promise<void> | void,
|
|
172
|
+
opts?: { priority?: number },
|
|
173
|
+
): void;
|
|
174
|
+
(
|
|
175
|
+
hookName: PluginHookName,
|
|
176
|
+
handler: (event: unknown, ctx: unknown) => unknown,
|
|
177
|
+
opts?: { priority?: number },
|
|
178
|
+
): void;
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
export type OpenClawPluginDefinition = {
|
|
183
|
+
id: string;
|
|
184
|
+
name: string;
|
|
185
|
+
description?: string;
|
|
186
|
+
version?: string;
|
|
187
|
+
register: (api: OpenClawPluginApi) => void | Promise<void>;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export function definePluginEntry(
|
|
191
|
+
def: OpenClawPluginDefinition,
|
|
192
|
+
): OpenClawPluginDefinition;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
declare module "openclaw/plugin-sdk/agent-runtime" {
|
|
196
|
+
export interface PreparedModel {
|
|
197
|
+
model: unknown;
|
|
198
|
+
auth: unknown;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export interface PreparedModelError {
|
|
202
|
+
error: string;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export function prepareSimpleCompletionModelForAgent(opts: {
|
|
206
|
+
cfg: unknown;
|
|
207
|
+
agentId: string;
|
|
208
|
+
modelRef?: string;
|
|
209
|
+
}): Promise<PreparedModel | PreparedModelError>;
|
|
210
|
+
|
|
211
|
+
export interface CompletionMessage {
|
|
212
|
+
role: string;
|
|
213
|
+
content: { type: string; text?: string }[];
|
|
214
|
+
timestamp: number;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export interface CompletionResult {
|
|
218
|
+
content: { type: string; text?: string }[];
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export function completeWithPreparedSimpleCompletionModel(opts: {
|
|
222
|
+
model: unknown;
|
|
223
|
+
auth: unknown;
|
|
224
|
+
context: {
|
|
225
|
+
systemPrompt?: string;
|
|
226
|
+
messages: CompletionMessage[];
|
|
227
|
+
};
|
|
228
|
+
options?: { maxTokens?: number };
|
|
229
|
+
}): Promise<CompletionResult>;
|
|
230
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineConfig } from "vitest/config";
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
test: {
|
|
5
|
+
include: ["tests/**/*.test.ts"],
|
|
6
|
+
env: {
|
|
7
|
+
// Point HOME to a nonexistent path so tests cannot accidentally read
|
|
8
|
+
// ~/.reflexio/.env or other real user config files. Tests that need
|
|
9
|
+
// specific home-dir content must set HOME themselves.
|
|
10
|
+
HOME: "/nonexistent-test-home",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Reflexio OpenClaw-Embedded Plugin
|
|
2
|
+
|
|
3
|
+
A lightweight Openclaw plugin that delivers Reflexio-style user profile and playbook capabilities entirely within Openclaw's native primitives — no Reflexio server required.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [How It Works](#how-it-works)
|
|
8
|
+
- [Prerequisites](#prerequisites)
|
|
9
|
+
- [Installation](#installation)
|
|
10
|
+
- [First-use Setup](#first-use-setup)
|
|
11
|
+
- [Configuration](#configuration)
|
|
12
|
+
- [Comparison with Other Reflexio Integrations](#comparison-with-other-reflexio-integrations)
|
|
13
|
+
- [Uninstall](#uninstall)
|
|
14
|
+
- [Further Reading](#further-reading)
|
|
15
|
+
|
|
16
|
+
## How It Works
|
|
17
|
+
|
|
18
|
+
The plugin captures two kinds of memory:
|
|
19
|
+
|
|
20
|
+
- **Profiles** — durable user facts (diet, preferences, timezone, role). Stored as `.md` files under `.reflexio/profiles/` with a TTL.
|
|
21
|
+
- **Playbooks** — procedural rules learned from corrections (user corrects → agent adjusts → user confirms → rule written). Stored under `.reflexio/playbooks/`.
|
|
22
|
+
|
|
23
|
+
Three flows capture memory at different moments:
|
|
24
|
+
|
|
25
|
+
- **Flow A (in-session profile)**: agent detects a preference/fact/config in the user message and writes immediately via the `reflexio_write_profile` tool.
|
|
26
|
+
- **Flow B (in-session playbook)**: agent recognizes correction+confirmation multi-turn pattern and writes via `reflexio_write_playbook`.
|
|
27
|
+
- **Flow C (session-end batch)**: hooks fire on `before_compaction`, `before_reset`, and `session_end`; spawn a `reflexio-extractor` sub-agent that extracts from the full transcript, runs dedup, and writes/deletes `.md` files.
|
|
28
|
+
|
|
29
|
+
Consolidation runs on-demand via `reflexio_run_consolidation` tool or automatically via heartbeat check (`reflexio_consolidation_check`). It clusters similar files, asks the LLM to deduplicate/merge/resolve contradictions, and writes one-fact-per-file outputs.
|
|
30
|
+
|
|
31
|
+
All retrieval is via Openclaw's memory engine — vector + FTS + MMR + temporal decay. When Active Memory is enabled, relevant profiles/playbooks are auto-injected into each turn.
|
|
32
|
+
|
|
33
|
+
## Prerequisites
|
|
34
|
+
|
|
35
|
+
- [OpenClaw](https://openclaw.ai) installed and `openclaw` CLI on PATH
|
|
36
|
+
- Node.js (for the plugin runtime)
|
|
37
|
+
- macOS or Linux (Windows via WSL)
|
|
38
|
+
- A bash-compatible shell (install/uninstall scripts use `#!/usr/bin/env bash`)
|
|
39
|
+
- Strongly recommended:
|
|
40
|
+
- An embedding provider API key (OpenAI, Gemini, Voyage, or Mistral) for vector search
|
|
41
|
+
- The `active-memory` plugin enabled (auto-retrieval into turns)
|
|
42
|
+
|
|
43
|
+
The plugin works without active-memory and without an embedding key — with degraded retrieval quality. See `references/architecture.md` for degradation modes.
|
|
44
|
+
|
|
45
|
+
## Installation
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# From the plugin directory:
|
|
49
|
+
./scripts/install.sh
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
What it does:
|
|
53
|
+
1. Installs the `plugin/` directory as an Openclaw plugin (copied to `~/.openclaw/extensions/reflexio-embedded/`)
|
|
54
|
+
2. Enables the `active-memory` plugin and configures agent targeting + `.reflexio/` extraPath
|
|
55
|
+
3. Restarts the Openclaw gateway
|
|
56
|
+
|
|
57
|
+
Skills are auto-served from the extension directory via the manifest. Agent definitions are injected via `extraSystemPrompt` at runtime. Heartbeat entry is appended to `HEARTBEAT.md` on first agent session by `setup.ts`.
|
|
58
|
+
|
|
59
|
+
## First-use Setup
|
|
60
|
+
|
|
61
|
+
The first time an agent invokes the `reflexio-embedded` skill, it runs a one-time bootstrap:
|
|
62
|
+
|
|
63
|
+
1. Probes current config via `openclaw config get` + `openclaw memory status --deep`.
|
|
64
|
+
2. For any missing prereq, asks the user for approval before running `openclaw config set`.
|
|
65
|
+
3. On success, creates `.reflexio/.setup_complete_<agentId>` marker — subsequent sessions skip.
|
|
66
|
+
|
|
67
|
+
This guarantees zero manual `openclaw.json` editing. If exec is denied by admin policy, the skill prints the exact commands for the user to run manually.
|
|
68
|
+
|
|
69
|
+
## Configuration
|
|
70
|
+
|
|
71
|
+
Defaults are defined in `openclaw.plugin.json` via `configSchema`. To override, add to your `openclaw.json`:
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"plugins": {
|
|
76
|
+
"entries": {
|
|
77
|
+
"reflexio-embedded": {
|
|
78
|
+
"config": {
|
|
79
|
+
"dedup": { "shallow_threshold": 0.4, "top_k": 5 },
|
|
80
|
+
"consolidation": { "threshold_hours": 24 }
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Tunables:
|
|
89
|
+
|
|
90
|
+
| Knob | Default | What it controls |
|
|
91
|
+
|---|---|---|
|
|
92
|
+
| `dedup.shallow_threshold` | 0.4 | Similarity above which in-session writes trigger dedup |
|
|
93
|
+
| `dedup.full_threshold` | 0.75 | Similarity cluster-member cutoff in consolidation |
|
|
94
|
+
| `dedup.top_k` | 5 | How many neighbors to consider |
|
|
95
|
+
| `ttl_sweep.on_bootstrap` | `true` | Whether to sweep expired profiles on each agent turn |
|
|
96
|
+
| `consolidation.threshold_hours` | 24 | Heartbeat consolidation interval |
|
|
97
|
+
| `extraction.subagent_timeout_seconds` | 120 | Flow C sub-agent timeout |
|
|
98
|
+
|
|
99
|
+
## Comparison with Other Reflexio Integrations
|
|
100
|
+
|
|
101
|
+
See `references/comparison.md` for a full matrix.
|
|
102
|
+
|
|
103
|
+
- **`integrations/openclaw-embedded/`** (this plugin): self-contained; no Reflexio server; single-user.
|
|
104
|
+
- **`integrations/openclaw/`** (federated): requires running Reflexio server; multi-user; cross-instance aggregation.
|
|
105
|
+
|
|
106
|
+
Both can coexist in the same Openclaw instance, but installing both serves no purpose — pick one.
|
|
107
|
+
|
|
108
|
+
## Uninstall
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
./scripts/uninstall.sh # preserves .reflexio/ user data
|
|
112
|
+
./scripts/uninstall.sh --purge # also deletes .reflexio/ user data
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Further Reading
|
|
116
|
+
|
|
117
|
+
- [Architecture deep-dive](references/architecture.md)
|
|
118
|
+
- [Prompt porting notes](references/porting-notes.md)
|
|
119
|
+
- [Future work / v2 deferrals](references/future-work.md)
|
|
120
|
+
- [Manual testing guide](TESTING.md)
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Manual Testing Guide
|
|
2
|
+
|
|
3
|
+
End-to-end manual validation of `openclaw-embedded`. Run this before each release.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- A clean Openclaw instance (fresh workspace, or separate test workspace)
|
|
8
|
+
- Node and openclaw CLI on PATH
|
|
9
|
+
- An embedding provider configured (optional but recommended for full coverage)
|
|
10
|
+
|
|
11
|
+
## 1. Unit tests
|
|
12
|
+
|
|
13
|
+
From the `openclaw-embedded/` directory:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm test
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Expected: 54 tests pass. If any fail, stop — fix before proceeding.
|
|
20
|
+
|
|
21
|
+
## 2. Hook smoke test
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
node plugin/hook/smoke-test.js
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Expected: all PASS lines printed, no FAIL.
|
|
28
|
+
|
|
29
|
+
## 3. Install plugin
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
./scripts/install.sh
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Expected verification output:
|
|
36
|
+
```text
|
|
37
|
+
✓ plugin registered and loaded
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
If any ⚠ warnings, investigate before moving on.
|
|
41
|
+
|
|
42
|
+
## 4. First-use bootstrap
|
|
43
|
+
|
|
44
|
+
- Open a new Openclaw agent session.
|
|
45
|
+
- Say: "test the reflexio-embedded skill setup".
|
|
46
|
+
- Expected: the agent invokes the skill, runs probing commands, asks for approval to configure active-memory and extraPath.
|
|
47
|
+
- Approve each step.
|
|
48
|
+
- Verify `.reflexio/.setup_complete_<agentId>` marker exists.
|
|
49
|
+
|
|
50
|
+
## 5. Flow A — profile capture
|
|
51
|
+
|
|
52
|
+
In the agent session:
|
|
53
|
+
|
|
54
|
+
- Say: "By the way, I'm vegetarian."
|
|
55
|
+
- Expected: agent writes `.reflexio/profiles/diet-vegetarian-<nanoid>.md` with:
|
|
56
|
+
- Frontmatter: `type: profile`, `id: prof_*`, `ttl: infinity`, `expires: never`
|
|
57
|
+
- Body: ~1-sentence description
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
cat .reflexio/profiles/diet-*.md
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Verify the file matches expectations.
|
|
64
|
+
|
|
65
|
+
## 6. Flow B — playbook capture
|
|
66
|
+
|
|
67
|
+
- Say: "Write a commit message for 'fix auth bug'."
|
|
68
|
+
- Expected: agent writes a commit message.
|
|
69
|
+
- Say: "No, don't add trailers."
|
|
70
|
+
- Expected: agent rewrites without trailers.
|
|
71
|
+
- Say: "Perfect, commit it."
|
|
72
|
+
- Expected: agent writes `.reflexio/playbooks/commit-no-trailers-<nanoid>.md`.
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
cat .reflexio/playbooks/commit-*.md
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Verify frontmatter + `## When` / `## What` / `## Why` sections.
|
|
79
|
+
|
|
80
|
+
## 7. Flow C — batch extraction at session boundary
|
|
81
|
+
|
|
82
|
+
- Have a longer conversation (5+ turns) covering facts and corrections.
|
|
83
|
+
- The `before_compaction`, `before_reset`, or `session_end` hook fires automatically.
|
|
84
|
+
- Expected: a `reflexio-extractor` sub-agent is spawned.
|
|
85
|
+
|
|
86
|
+
Check `.reflexio/profiles/` and `.reflexio/playbooks/` — new files should have appeared corresponding to any facts/corrections the agent missed in-session.
|
|
87
|
+
|
|
88
|
+
## 8. Retrieval validation
|
|
89
|
+
|
|
90
|
+
Start a new session. Ask: "What do you know about my diet?"
|
|
91
|
+
|
|
92
|
+
- With Active Memory enabled: expected answer references "vegetarian" from the captured profile.
|
|
93
|
+
- With Active Memory disabled: expected agent calls `reflexio_search` tool, then answers.
|
|
94
|
+
|
|
95
|
+
## 9. Consolidation (on-demand)
|
|
96
|
+
|
|
97
|
+
After accumulating 10+ entries across sessions, run:
|
|
98
|
+
|
|
99
|
+
```text
|
|
100
|
+
/skill reflexio-consolidate
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Expected:
|
|
104
|
+
- Agent calls `reflexio_run_consolidation` tool.
|
|
105
|
+
- Returns "Consolidation started in background."
|
|
106
|
+
- Logs show clustering, LLM judgment, and file write/delete activity.
|
|
107
|
+
|
|
108
|
+
Check `.reflexio/` before and after — duplicate or overlapping entries should be consolidated into individual fact files.
|
|
109
|
+
|
|
110
|
+
## 10. TTL sweep
|
|
111
|
+
|
|
112
|
+
- Create a profile with short TTL:
|
|
113
|
+
```text
|
|
114
|
+
Call the `reflexio_write_profile` tool with: slug="test-temp", ttl="one_day", body="temp fact"
|
|
115
|
+
```
|
|
116
|
+
- Manually edit its `expires` to a past date:
|
|
117
|
+
```bash
|
|
118
|
+
# Edit .reflexio/profiles/test-temp-*.md — set expires: 2020-01-01
|
|
119
|
+
```
|
|
120
|
+
- Start a new agent turn (triggers `before_prompt_build` hook with TTL sweep).
|
|
121
|
+
- Expected: the expired profile is deleted.
|
|
122
|
+
|
|
123
|
+
## 11. Degradation: no Active Memory
|
|
124
|
+
|
|
125
|
+
- Disable active-memory: `openclaw plugins disable active-memory`
|
|
126
|
+
- Restart gateway.
|
|
127
|
+
- Start new session, ask a question whose answer needs a captured profile.
|
|
128
|
+
- Expected: agent calls `reflexio_search` tool explicitly (per SKILL.md fallback), then answers.
|
|
129
|
+
- Re-enable: `openclaw plugins enable active-memory`.
|
|
130
|
+
|
|
131
|
+
## 12. Degradation: no embedding provider
|
|
132
|
+
|
|
133
|
+
- Unset embedding env vars.
|
|
134
|
+
- Restart gateway.
|
|
135
|
+
- Ask the agent something whose answer needs retrieval.
|
|
136
|
+
- Expected: retrieval works via FTS only (quality lower but functional).
|
|
137
|
+
|
|
138
|
+
## 13. Uninstall
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
./scripts/uninstall.sh
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Verify:
|
|
145
|
+
- `openclaw plugins inspect reflexio-embedded` shows not loaded.
|
|
146
|
+
- `~/.openclaw/extensions/reflexio-embedded/` does not exist.
|
|
147
|
+
- `.reflexio/` in the workspace is preserved.
|
|
148
|
+
|
|
149
|
+
Run `./scripts/uninstall.sh --purge` in a test workspace to verify `.reflexio/` is deleted.
|
|
150
|
+
|
|
151
|
+
## Test report template
|
|
152
|
+
|
|
153
|
+
When testing for a release:
|
|
154
|
+
|
|
155
|
+
```text
|
|
156
|
+
Tested: <date> <tester>
|
|
157
|
+
Openclaw version: <version>
|
|
158
|
+
Unit tests: <pass/fail>
|
|
159
|
+
Hook smoke test: <pass/fail>
|
|
160
|
+
Flow A: <pass/fail — notes>
|
|
161
|
+
Flow B: <pass/fail — notes>
|
|
162
|
+
Flow C: <pass/fail — notes>
|
|
163
|
+
Retrieval: <pass/fail — notes>
|
|
164
|
+
Consolidation: <pass/fail — notes>
|
|
165
|
+
TTL sweep: <pass/fail — notes>
|
|
166
|
+
Degradation modes: <pass/fail — notes>
|
|
167
|
+
Uninstall: <pass/fail — notes>
|
|
168
|
+
```
|