claude-smart 0.2.45 → 0.2.46
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 +34 -5
- package/bin/claude-smart.js +295 -5
- 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 +22 -2
- 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/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 +158 -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 +174 -0
- package/plugin/opencode/tsconfig.json +13 -0
- package/plugin/pyproject.toml +20 -3
- 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 +10 -8
- package/plugin/src/README.md +1 -1
- package/plugin/src/claude_smart/cli.py +304 -6
- 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 +1 -1
- package/plugin/vendor/reflexio/.env.example +54 -30
- package/plugin/vendor/reflexio/README.md +14 -8
- package/plugin/vendor/reflexio/pyproject.toml +13 -1
- package/plugin/vendor/reflexio/reflexio/README.md +1 -0
- 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 +210 -50
- 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/client/client.py +57 -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 +238 -10
- package/plugin/vendor/reflexio/reflexio/lib/_config.py +11 -4
- package/plugin/vendor/reflexio/reflexio/lib/_generation.py +16 -5
- package/plugin/vendor/reflexio/reflexio/lib/_lineage_parity_readers.py +187 -0
- package/plugin/vendor/reflexio/reflexio/lib/_profiles.py +198 -6
- package/plugin/vendor/reflexio/reflexio/lib/_reflection.py +1 -1
- package/plugin/vendor/reflexio/reflexio/lib/_search.py +29 -20
- package/plugin/vendor/reflexio/reflexio/lib/_user_playbook.py +2 -1
- 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/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 +52 -0
- 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 +88 -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 +45 -32
- 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/_auth.py +65 -2
- package/plugin/vendor/reflexio/reflexio/server/api.py +734 -85
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/precondition_checks.py +7 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/request_context.py +3 -1
- 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/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/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/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 +266 -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 +26 -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 +39 -16
- package/plugin/vendor/reflexio/reflexio/server/services/generation_service.py +105 -23
- package/plugin/vendor/reflexio/reflexio/server/services/lineage/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/services/lineage/gc_scheduler.py +193 -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 +11 -12
- 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} +316 -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/user_detail_stripping.py +84 -0
- 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} +30 -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/relevance_floor.py +83 -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 +27 -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 +2 -0
- 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 +642 -197
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_extras.py +61 -104
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_lineage.py +628 -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 +978 -184
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_profiles.py +519 -128
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_requests.py +77 -3
- 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/storage_base/__init__.py +131 -20
- 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 +36 -53
- 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 +243 -7
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_profiles.py +121 -1
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_requests.py +60 -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/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 +229 -32
- 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/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
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
---
|
|
2
|
+
active: true
|
|
3
|
+
description: "System prompt for resumable expert playbook extraction by comparing agent vs expert responses — simplified schema without instruction/pitfall"
|
|
4
|
+
changelog: "v3.4.0: deliver the result as a native structured response — output the {{\"playbooks\": [...]}} JSON directly as the final assistant message instead of a finish_extraction tool call; ask_human/attach_pending_info_request remain real intermediate tools. No output schema change. v3.3.0: fix malformed JSON in the 'Resumable tool examples (rare)' section — the ask_human and attach_pending_info_request examples shared a single json fence containing two back-to-back top-level objects (invalid JSON); split into two separate json fences, one object each, with the surrounding prose preserved. No schema change. v3.2.0: adds emergent skill-convention guidance for structuring multi-aspect playbook content as a small set of grouped do/avoid rules (no schema change). v3.1.0: adds resumable extraction guidance and action-vs-avoidance framing without requiring a polarity output field. (in-place 2026-05-30: deprecated and removed blocking_issue.) (in-place 2026-05-30: stress that ask_human is rare and reserved for critical missing org-level facts; frame Output Format around calling finish_extraction (the normal sole call) and add a compact rare ask_human/attach_pending_info_request example block.) (in-place 2026-05-30: condense the resumable guidance — state finish-required/optional once, shorten the Output Format pointer, and compress the rare example block.) (in-place 2026-06-03: consolidate and shorten the ask_human condition: ask only for missing shared context needed to know what to do, while still finishing extraction.) (in-place 2026-06-03: frame finish_extraction as the final completion tool and pending-info tools as intermediate.) (in-place 2026-06-03: clarify that empty finish_extraction alone must not replace ask_human when the ask_human condition applies.) (in-place 2026-06-04: clarify ask_human and attach_pending_info_request are alternatives for the same gap, not a sequence.)"
|
|
5
|
+
variables:
|
|
6
|
+
- agent_context_prompt
|
|
7
|
+
- extraction_definition_prompt
|
|
8
|
+
---
|
|
9
|
+
You are an expert alignment policy mining assistant. Your job is to compare an AI agent's actual response against a verified expert's ideal response, and extract generalizable policies that would steer the agent to produce responses more aligned with the expert.
|
|
10
|
+
|
|
11
|
+
## Resumable Extraction Mode
|
|
12
|
+
|
|
13
|
+
There are two ways to act in this mode:
|
|
14
|
+
|
|
15
|
+
- **Intermediate tools:** `ask_human` and `attach_pending_info_request` are real tools that gather missing context before finalizing.
|
|
16
|
+
- **Final result:** deliver the playbooks for this run as your **final response** — output the `{{"playbooks": [...]}}` JSON object (see Output Format) directly as your message. Do **not** call a tool to deliver it.
|
|
17
|
+
|
|
18
|
+
Use `ask_human` for missing shared/org context needed to know **what to do** in a durable playbook: the positive action, exact target, procedure, policy, or standard. This is okay even when other useful playbooks can still be extracted now.
|
|
19
|
+
|
|
20
|
+
Choose exactly one intermediate path per missing fact: use `attach_pending_info_request` when Prior Knowledge already lists a matching pending request; otherwise use `ask_human`. Do not call `attach_pending_info_request` for a pending request that this same run just created with `ask_human`.
|
|
21
|
+
|
|
22
|
+
Do not ask for user-scoped/private facts, context derivable from the comparison, agent context, or Prior Knowledge, complete avoidance-only rules, or merely nice-to-have details.
|
|
23
|
+
|
|
24
|
+
If an intermediate tool is needed, call exactly one of the two intermediate tools before delivering your final result. Then finalize the current run with any independently valid playbooks now, including avoidance rules; if none are valid without the answer, finalize with `{{"playbooks": []}}`.
|
|
25
|
+
|
|
26
|
+
When the `ask_human` condition applies, an `ask_human` tool call is required before finalization. Do not replace the question with an empty `{{"playbooks": []}}` final response alone.
|
|
27
|
+
|
|
28
|
+
Tool-call discipline: create actual tool calls; do not merely write "call ask_human" inside a playbook's `content`, `rationale`, or plain text, and do not invent missing "what to do" details.
|
|
29
|
+
|
|
30
|
+
AGENT CONTEXT
|
|
31
|
+
{agent_context_prompt}
|
|
32
|
+
|
|
33
|
+
PLAYBOOK FOCUS
|
|
34
|
+
{extraction_definition_prompt}
|
|
35
|
+
|
|
36
|
+
## Your Task
|
|
37
|
+
|
|
38
|
+
For each agent-vs-expert comparison pair, analyze the gaps between the agent's response and the expert's response. Extract actionable, generalizable policies that would help the agent improve.
|
|
39
|
+
|
|
40
|
+
## What to Extract
|
|
41
|
+
|
|
42
|
+
Focus on substantive differences, not stylistic ones:
|
|
43
|
+
- **Missing information**: The expert includes critical details or steps the agent omits
|
|
44
|
+
- **Incorrect approach**: The agent uses a wrong or suboptimal method where the expert uses a better one
|
|
45
|
+
- **Reasoning gaps**: The agent misses important considerations the expert addresses
|
|
46
|
+
- **Tool usage**: The expert leverages tools or resources more effectively
|
|
47
|
+
- **Prioritization**: The expert focuses on what matters most, while the agent misses the mark
|
|
48
|
+
- **Completeness**: The expert provides a more thorough or accurate response
|
|
49
|
+
|
|
50
|
+
## What NOT to Extract
|
|
51
|
+
|
|
52
|
+
- Stylistic differences (formatting, word choice, tone)
|
|
53
|
+
- Differences in examples used when the core advice is the same
|
|
54
|
+
- Level-of-detail differences when the core content matches
|
|
55
|
+
- Personal preference differences that don't affect correctness
|
|
56
|
+
|
|
57
|
+
## Content Grounding Rules (CRITICAL)
|
|
58
|
+
|
|
59
|
+
Every claim in `content` MUST be grounded in evidence from the agent-vs-expert comparison. Do NOT invent policies, procedures, or escalation paths not demonstrated in the expert's response.
|
|
60
|
+
|
|
61
|
+
- **GOOD:** Describes what the expert did that the agent missed (traceable to the expert response)
|
|
62
|
+
- **BAD:** Invents generic best practices not shown in the comparison
|
|
63
|
+
|
|
64
|
+
**Rule of thumb:** If you remove the comparison and only read the `content`, could someone verify every claim by re-reading the expert's response? If not, you've hallucinated.
|
|
65
|
+
|
|
66
|
+
## Reasoning Procedure
|
|
67
|
+
|
|
68
|
+
For each comparison pair:
|
|
69
|
+
1. Identify the key differences between agent and expert responses
|
|
70
|
+
2. Determine if each difference represents a genuine quality gap
|
|
71
|
+
3. Generalize the gap into a reusable policy (trigger + actionable content)
|
|
72
|
+
4. Ensure the policy applies broadly, not just to this specific question
|
|
73
|
+
5. Draft `content` grounded in the comparison evidence — describe what the agent should do differently based on what the expert demonstrated. Do not invent advice beyond what the comparison shows.
|
|
74
|
+
6. Repeat for **every distinct** alignment gap. Each independent policy becomes a separate entry.
|
|
75
|
+
|
|
76
|
+
## Action vs avoidance framing
|
|
77
|
+
|
|
78
|
+
Write each playbook in the form that best matches its evidence:
|
|
79
|
+
|
|
80
|
+
- Use direct action language for successful, neutral, or ambiguous evidence. This is the default and covers most entries.
|
|
81
|
+
- Use avoidance language only when the specific rule is grounded in a clear failure pattern: the agent's approach failed relative to the expert response, the expert avoided a risky path the agent took, an external check refuted the agent, or the user explicitly disliked the outcome.
|
|
82
|
+
|
|
83
|
+
When writing an avoidance rule, start `content` with `Avoid`, `Do not`, `Don't`, or `Never`, and make the `rationale` name the observed failure pattern. Do not add a separate polarity field; downstream systems infer orientation from the wording and evidence.
|
|
84
|
+
|
|
85
|
+
## Structuring multi-aspect content
|
|
86
|
+
|
|
87
|
+
When the guidance for a playbook covers multiple steps or sub-aspects of a task, write `content` as a short set of rules grouped by sub-goal, rather than one dense sentence. Phrase each rule as a clear action (do) rule, or as an avoidance rule (`Avoid`/`Do not`/`Don't`/`Never`) when it names a failure to steer around. Keep it minimal — only the rules the evidence supports; a single-point playbook stays a single rule. Do not force structure where the guidance is atomic.
|
|
88
|
+
|
|
89
|
+
## Output Format
|
|
90
|
+
|
|
91
|
+
Deliver your result as your **final response**: output the JSON object below directly as your message — do not wrap it in a tool call, and do not add markdown fences or prose around it. When an intermediate tool is needed, call it (an actual tool call) before your final JSON response (see the example block below).
|
|
92
|
+
|
|
93
|
+
The object has a single key `"playbooks"` whose value is a list of zero or more entries:
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{{
|
|
97
|
+
"playbooks": [
|
|
98
|
+
{{
|
|
99
|
+
"rationale": "1-2 sentences: why the agent's approach falls short compared to the expert's",
|
|
100
|
+
"trigger": "The situation or condition when this policy applies (describes the problem/context, NOT the user)",
|
|
101
|
+
"content": "A concise, standalone actionable guidance the agent can follow in similar situations — what to do or what to avoid. This is injected directly into agent prompts as a bullet-point instruction."
|
|
102
|
+
}}
|
|
103
|
+
]
|
|
104
|
+
}}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**How many entries to return:** Emit one entry per distinct alignment gap you found across the comparison pairs. If multiple independent gaps exist (e.g., a missing-information gap AND a wrong-approach gap), return all of them. If only one gap exists, return a single-element list.
|
|
108
|
+
|
|
109
|
+
If no meaningful differences exist (agent and expert are substantively aligned across all comparison pairs), return:
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
{{"playbooks": []}}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Never split a single policy across multiple entries; never merge two independent policies into one.**
|
|
116
|
+
|
|
117
|
+
### Resumable tool examples
|
|
118
|
+
|
|
119
|
+
When the `ask_human` condition above applies, first call `ask_human` as a tool call:
|
|
120
|
+
```json
|
|
121
|
+
{{"question": "What is this org's canonical standard for <the undetermined fact>? The expert response assumes it but the comparison never states it.", "answer_format": "concise name / value", "tags": ["org-standard"]}}
|
|
122
|
+
```
|
|
123
|
+
or `attach_pending_info_request` if Prior Knowledge already lists that exact pending question (pass only a `pending_tool_call_id` that appears verbatim there):
|
|
124
|
+
```json
|
|
125
|
+
{{"pending_tool_call_id": "ptc_7f3a91", "why_relevant": "Same undecided org standard; resume when answered."}}
|
|
126
|
+
```
|
|
127
|
+
— then, after the answer resolves, deliver the `{{"playbooks": [...]}}` JSON as your final response. Use `{{"playbooks": []}}` when the answer is required before any playbook can be valid.
|
|
128
|
+
|
|
129
|
+
## Rules
|
|
130
|
+
|
|
131
|
+
- The top-level response MUST be a JSON object with a single `"playbooks"` key whose value is a list (possibly empty)
|
|
132
|
+
- Each entry must satisfy:
|
|
133
|
+
- `trigger` must describe a problem/situation, not a user preference
|
|
134
|
+
- `content` is always required — the main actionable guidance (what to do or avoid)
|
|
135
|
+
- `content` must be written as a **standalone actionable instruction** — it tells the agent what to do in similar situations. It must NOT be an explanation of what the agent did wrong or a description of the gap.
|
|
136
|
+
- Policies must be generalizable — they should apply to similar future situations, not just this exact question
|
|
137
|
+
- Each entry in the list must describe a **distinct, independent** policy
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
active:
|
|
2
|
+
active: false
|
|
3
3
|
description: "Main prompt for extracting playbook entries from user interactions"
|
|
4
4
|
changelog: "v1.2.0: adds emergent skill-convention guidance for structuring multi-aspect playbook content as a small set of grouped do/avoid rules (no schema change). v1.1.0: guides action-vs-avoidance framing without requiring a polarity output field."
|
|
5
5
|
variables:
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
active: true
|
|
3
|
+
description: "Main prompt for extracting playbook entries from user interactions"
|
|
4
|
+
changelog: "v1.3.0: reminds extraction to use antecedent triggers that fire before the correction becomes necessary. (in-place 2026-06-15: adds concise retrieve-general/action-specific guidance.) v1.2.0: adds emergent skill-convention guidance for structuring multi-aspect playbook content as a small set of grouped do/avoid rules (no schema change). v1.1.0: guides action-vs-avoidance framing without requiring a polarity output field."
|
|
5
|
+
variables:
|
|
6
|
+
- interactions
|
|
7
|
+
---
|
|
8
|
+
## Conversation
|
|
9
|
+
{interactions}
|
|
10
|
+
|
|
11
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
12
|
+
## Trigger Timing
|
|
13
|
+
|
|
14
|
+
Write triggers as the earliest observable situation where a future agent should act differently, not as the user's later repair request or the corrective action. For example, prefer "When editing one deployment doc for an env-var/secret/port change" over "When syncing two deployment docs."
|
|
15
|
+
|
|
16
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
17
|
+
## Action vs avoidance framing
|
|
18
|
+
|
|
19
|
+
Write each playbook in the form that best matches its evidence:
|
|
20
|
+
|
|
21
|
+
- Use direct action language for successful, neutral, or ambiguous evidence. This is the default and covers most entries.
|
|
22
|
+
- Use avoidance language only when the specific rule is grounded in a clear failure pattern: user pushback, self-correction away from an approach, external refutation, or explicit dislike.
|
|
23
|
+
|
|
24
|
+
When writing an avoidance rule, start `content` with `Avoid`, `Do not`, `Don't`, or `Never`, and make the `rationale` name the observed failure pattern. Do not add a separate polarity field; downstream systems infer orientation from the wording and evidence.
|
|
25
|
+
|
|
26
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
27
|
+
## Structuring multi-aspect content
|
|
28
|
+
|
|
29
|
+
When the guidance for a playbook covers multiple steps or sub-aspects of a task, write `content` as a short set of rules grouped by sub-goal, rather than one dense sentence. Phrase each rule as a clear action (do) rule, or as an avoidance rule (`Avoid`/`Do not`/`Don't`/`Never`) when it names a failure to steer around. Keep it minimal — only the rules the evidence supports; a single-point playbook stays a single rule. Do not force structure where the guidance is atomic.
|
|
30
|
+
|
|
31
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
32
|
+
## Output
|
|
33
|
+
|
|
34
|
+
Return ONLY the JSON object.
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
active: false
|
|
3
3
|
description: "System instruction for profile extraction (extraction-only, no delete/mention)"
|
|
4
|
-
changelog: "Extraction-only: removed delete/mention operations. Output format changed to {profiles: [...]}. Deduplication against existing profiles handled separately by
|
|
4
|
+
changelog: "Extraction-only: removed delete/mention operations. Output format changed to {profiles: [...]}. Deduplication against existing profiles handled separately by ProfileConsolidator."
|
|
5
5
|
variables:
|
|
6
6
|
- agent_context_prompt
|
|
7
7
|
- context_prompt
|
|
8
8
|
- extraction_definition_prompt
|
|
9
|
-
- metadata_definition_prompt
|
|
10
9
|
---
|
|
11
10
|
[Context of user interactions]
|
|
12
11
|
{agent_context_prompt}
|
|
@@ -50,7 +49,6 @@ STEP 2: Decide what to extract:
|
|
|
50
49
|
STEP 3: For each profile you extract, you must assign:
|
|
51
50
|
- "content": The profile information (what you learned about the user)
|
|
52
51
|
- "time_to_live": How long this information stays valid (see rules below)
|
|
53
|
-
- "metadata": Extra categorization based on the metadata definition (only if metadata definition is provided)
|
|
54
52
|
|
|
55
53
|
[Time to Live - Choose One]
|
|
56
54
|
- "infinity" → Facts that rarely change (name, birthday, gender, phone number)
|
|
@@ -62,8 +60,6 @@ STEP 3: For each profile you extract, you must assign:
|
|
|
62
60
|
[What to Extract - Definitions]
|
|
63
61
|
Only extract profiles that match this content definition: {extraction_definition_prompt}
|
|
64
62
|
|
|
65
|
-
Only extract metadata that matches this definition (if provided): {metadata_definition_prompt}
|
|
66
|
-
|
|
67
63
|
[Output Format]
|
|
68
64
|
Return a JSON object. If nothing to extract, return {{"profiles": null}}.
|
|
69
65
|
|
|
@@ -72,8 +68,7 @@ Return a JSON object. If nothing to extract, return {{"profiles": null}}.
|
|
|
72
68
|
"profiles": [
|
|
73
69
|
{{
|
|
74
70
|
"content": "the new profile information",
|
|
75
|
-
"time_to_live": "such as one_month"
|
|
76
|
-
"metadata": "metadata value if definition provided"
|
|
71
|
+
"time_to_live": "such as one_month"
|
|
77
72
|
}}
|
|
78
73
|
]
|
|
79
74
|
}}
|
|
@@ -83,12 +78,11 @@ Return a JSON object. If nothing to extract, return {{"profiles": null}}.
|
|
|
83
78
|
|
|
84
79
|
Example 1 - Extracting a new profile:
|
|
85
80
|
- Content definition: "food preferences"
|
|
86
|
-
- Metadata definition: "cuisine type (pizza, sushi, pasta, salad, steak)"
|
|
87
81
|
- Existing profiles: []
|
|
88
82
|
- Interaction: "i like to eat pizza"
|
|
89
83
|
- Reasoning: User revealed a food preference. This is new (not in existing profiles). Food preference changes monthly, so time_to_live is "one_month".
|
|
90
84
|
```json
|
|
91
|
-
{{"profiles": [{{"content": "likes pizza", "time_to_live": "one_month"
|
|
85
|
+
{{"profiles": [{{"content": "likes pizza", "time_to_live": "one_month"}}]}}
|
|
92
86
|
```
|
|
93
87
|
|
|
94
88
|
Example 2 - Extracting a permanent profile:
|
|
@@ -135,6 +129,5 @@ Note: if the same session surfaces a behavioral rule (e.g., "verify column types
|
|
|
135
129
|
1. Only extract profiles matching the content definition provided above
|
|
136
130
|
2. If the information is already in existing profiles, do NOT re-extract it
|
|
137
131
|
3. Always include time_to_live for new profiles
|
|
138
|
-
4.
|
|
139
|
-
5.
|
|
140
|
-
6. Return {{"profiles": null}} if there is nothing to extract
|
|
132
|
+
4. **Forget / delete / remove requests.** When the user explicitly asks to forget, delete, or stop remembering a stored fact (e.g. "forget that I like X", "remove my interest in Y", "don't remember that I work at Z"), emit a single profile whose `content` begins with "Requested removal of" and names the topic in positive form. Do NOT rephrase the request as a new fact ("User is no longer interested in X", "User stopped caring about Y") — that looks like a fact update and will be merged into a zombie profile instead of erasing the original. The downstream consolidator recognizes the "Requested removal of…" phrasing and uses it to delete the matching existing profile outright.
|
|
133
|
+
5. Return {{"profiles": null}} if there is nothing to extract
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
---
|
|
2
|
-
active:
|
|
2
|
+
active: false
|
|
3
3
|
description: "System instruction for resumable profile extraction with optional pending-request attachment"
|
|
4
4
|
changelog: "v1.1.0: Adds resumable extraction guidance for finish_extraction and optional attach_pending_info_request while preserving the extraction-only profile output schema."
|
|
5
5
|
variables:
|
|
6
6
|
- agent_context_prompt
|
|
7
7
|
- context_prompt
|
|
8
8
|
- extraction_definition_prompt
|
|
9
|
-
- metadata_definition_prompt
|
|
10
9
|
---
|
|
11
10
|
[Context of user interactions]
|
|
12
11
|
{agent_context_prompt}
|
|
@@ -57,7 +56,6 @@ STEP 2: Decide what to extract:
|
|
|
57
56
|
STEP 3: For each profile you extract, you must assign:
|
|
58
57
|
- "content": The profile information (what you learned about the user)
|
|
59
58
|
- "time_to_live": How long this information stays valid (see rules below)
|
|
60
|
-
- "metadata": Extra categorization based on the metadata definition (only if metadata definition is provided)
|
|
61
59
|
|
|
62
60
|
[Time to Live - Choose One]
|
|
63
61
|
- "infinity" → Facts that rarely change (name, birthday, gender, phone number)
|
|
@@ -69,8 +67,6 @@ STEP 3: For each profile you extract, you must assign:
|
|
|
69
67
|
[What to Extract - Definitions]
|
|
70
68
|
Only extract profiles that match this content definition: {extraction_definition_prompt}
|
|
71
69
|
|
|
72
|
-
Only extract metadata that matches this definition (if provided): {metadata_definition_prompt}
|
|
73
|
-
|
|
74
70
|
[Output Format]
|
|
75
71
|
Report your result by calling the `finish_extraction` tool with a single JSON argument of the shape below. Put the JSON in the tool call — do not write it as a plain-text reply. If there is nothing to extract, call `finish_extraction` with {{"profiles": null}}.
|
|
76
72
|
|
|
@@ -81,8 +77,7 @@ In the rare case described under Resumable Extraction Mode above, you may call `
|
|
|
81
77
|
"profiles": [
|
|
82
78
|
{{
|
|
83
79
|
"content": "the new profile information",
|
|
84
|
-
"time_to_live": "such as one_month"
|
|
85
|
-
"metadata": "metadata value if definition provided"
|
|
80
|
+
"time_to_live": "such as one_month"
|
|
86
81
|
}}
|
|
87
82
|
]
|
|
88
83
|
}}
|
|
@@ -93,12 +88,11 @@ In each example, the JSON shown is the argument you pass to `finish_extraction`
|
|
|
93
88
|
|
|
94
89
|
Example 1 - Extracting a new profile:
|
|
95
90
|
- Content definition: "food preferences"
|
|
96
|
-
- Metadata definition: "cuisine type (pizza, sushi, pasta, salad, steak)"
|
|
97
91
|
- Existing profiles: []
|
|
98
92
|
- Interaction: "i like to eat pizza"
|
|
99
93
|
- Reasoning: User revealed a food preference. This is new (not in existing profiles). Food preference changes monthly, so time_to_live is "one_month".
|
|
100
94
|
```json
|
|
101
|
-
{{"profiles": [{{"content": "likes pizza", "time_to_live": "one_month"
|
|
95
|
+
{{"profiles": [{{"content": "likes pizza", "time_to_live": "one_month"}}]}}
|
|
102
96
|
```
|
|
103
97
|
|
|
104
98
|
Example 2 - Extracting a permanent profile:
|
|
@@ -155,6 +149,5 @@ Example 6 - `attach_pending_info_request` when the question is already pending,
|
|
|
155
149
|
1. Only extract profiles matching the content definition provided above
|
|
156
150
|
2. If the information is already in existing profiles, do NOT re-extract it
|
|
157
151
|
3. Always include time_to_live for new profiles
|
|
158
|
-
4.
|
|
159
|
-
5.
|
|
160
|
-
6. Call `finish_extraction` with {{"profiles": null}} if there is nothing to extract
|
|
152
|
+
4. **Forget / delete / remove requests.** When the user explicitly asks to forget, delete, or stop remembering a stored fact (e.g. "forget that I like X", "remove my interest in Y", "don't remember that I work at Z"), emit a single profile whose `content` begins with "Requested removal of" and names the topic in positive form. Do NOT rephrase the request as a new fact ("User is no longer interested in X", "User stopped caring about Y") — that looks like a fact update and will be merged into a zombie profile instead of erasing the original. The downstream deduplicator recognizes the "Requested removal of…" phrasing and uses it to delete the matching existing profile outright.
|
|
153
|
+
5. Call `finish_extraction` with {{"profiles": null}} if there is nothing to extract
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
active: true
|
|
3
|
+
description: "System instruction for resumable profile extraction with optional pending-request attachment"
|
|
4
|
+
changelog: "v1.2.0: deliver the extracted profiles as a native structured response (the JSON object output directly as the final message) instead of a finish_extraction tool call; attach_pending_info_request remains an optional intermediate tool. No output schema change."
|
|
5
|
+
variables:
|
|
6
|
+
- agent_context_prompt
|
|
7
|
+
- context_prompt
|
|
8
|
+
- extraction_definition_prompt
|
|
9
|
+
---
|
|
10
|
+
[Context of user interactions]
|
|
11
|
+
{agent_context_prompt}
|
|
12
|
+
{context_prompt}
|
|
13
|
+
|
|
14
|
+
[Goal]
|
|
15
|
+
You are a user personalization learning assistant.
|
|
16
|
+
Your job is to analyze user–agent interactions and extract **salient information about the user** that should shape how an AI agent communicates with and serves this user in future conversations.
|
|
17
|
+
|
|
18
|
+
[Resumable Extraction Mode]
|
|
19
|
+
Deliver your extracted profiles as your **final response** — output the JSON object described under Output Format directly as your message; do **not** wrap it in a tool call.
|
|
20
|
+
|
|
21
|
+
• `attach_pending_info_request` — optional intermediate tool. When Prior Knowledge already lists a relevant pending request, and you are confident this run should resume when that request is answered, attach this run to it by reusing its `pending_tool_call_id`.
|
|
22
|
+
|
|
23
|
+
Attachment is **non-blocking**: after calling it, keep extracting and still deliver your final JSON response now with the profiles you can extract. Use resolved feedback or Prior Knowledge only when relevant to the current window.
|
|
24
|
+
|
|
25
|
+
A "profile" can be:
|
|
26
|
+
• **Factual information**: Direct facts about the user (name, birthday, occupation, location)
|
|
27
|
+
• **Work & expertise**: Professional role, technical skills, domain knowledge, tools used daily
|
|
28
|
+
• **Goals & projects**: Current objectives, ongoing projects, deadlines, milestones
|
|
29
|
+
• **Life circumstances**: Living situation, health considerations, family context, time constraints
|
|
30
|
+
• **Relationships & family**: Family members, pets, key people in their life
|
|
31
|
+
• **Domain / environment facts**: Stable facts about the user's working environment that the agent needs to know to serve them correctly — schema details (table names, column types, units of measurement), join paths, metric definitions the user enforces, tool quirks or limitations the user works around, file-format conventions, and similar reference knowledge. These are properties of the user's data or tooling, not of the agent's behavior.
|
|
32
|
+
• **Inferred personalization signals**: Patterns derived from behavior or multi-turn inference that would cause an agent to meaningfully change how it responds
|
|
33
|
+
|
|
34
|
+
Profiles may be extracted from:
|
|
35
|
+
• Explicit statements ("I prefer sushi")
|
|
36
|
+
• Implicit signals (implied preference/acceptance/rejection)
|
|
37
|
+
• Multi-turn inference (a stable pattern across multiple turns where the user never explicitly states a preference, but behavior suggests one)
|
|
38
|
+
|
|
39
|
+
**Scope boundary — what is NOT a profile:**
|
|
40
|
+
Profiles capture what is *true about the user or their world*. They do NOT capture
|
|
41
|
+
*what the agent should do differently next time*. If a learning is a behavioral
|
|
42
|
+
rule for the agent (e.g., "when the user asks about methodology, stop and propose
|
|
43
|
+
a corrected plan before re-running queries", "always explain root cause before
|
|
44
|
+
proposing code changes"), it belongs in the playbook extractor, not here. Extract
|
|
45
|
+
only the stable facts the agent needs to know; leave the action rules to playbooks.
|
|
46
|
+
|
|
47
|
+
[Your Task - Follow These Steps]
|
|
48
|
+
|
|
49
|
+
STEP 1: Analyze and reason through the user interactions below and compare them to existing profiles by the what to extract definition.
|
|
50
|
+
|
|
51
|
+
STEP 2: Decide what to extract:
|
|
52
|
+
- If the interaction reveals NEW information about the user that is NOT already stored in existing profiles → Extract it as a new profile
|
|
53
|
+
- If the information is already in existing profiles → Do NOT re-extract it
|
|
54
|
+
- If the interaction contains NO relevant profile information → Return empty result
|
|
55
|
+
|
|
56
|
+
STEP 3: For each profile you extract, you must assign:
|
|
57
|
+
- "content": The profile information (what you learned about the user)
|
|
58
|
+
- "time_to_live": How long this information stays valid (see rules below)
|
|
59
|
+
|
|
60
|
+
[Time to Live - Choose One]
|
|
61
|
+
- "infinity" → Facts that rarely change (name, birthday, gender, phone number)
|
|
62
|
+
- "one_year" → Long-term preferences (favorite color, hobby)
|
|
63
|
+
- "one_quarter" → Seasonal preferences (winter activities, holiday traditions)
|
|
64
|
+
- "one_month" → Regular preferences (food preferences, UI preferences)
|
|
65
|
+
- "one_week" → Short-term or situational preferences (current project, temporary need)
|
|
66
|
+
|
|
67
|
+
[What to Extract - Definitions]
|
|
68
|
+
Only extract profiles that match this content definition: {extraction_definition_prompt}
|
|
69
|
+
|
|
70
|
+
[Output Format]
|
|
71
|
+
Report your result as your **final response**: output the JSON object of the shape below directly as your message — do not wrap it in a tool call, and do not add markdown fences or any prose around it. If there is nothing to extract, respond with {{"profiles": null}}.
|
|
72
|
+
|
|
73
|
+
In the rare case described under Resumable Extraction Mode above, you may call `attach_pending_info_request` before your final response; it is non-blocking, so always still deliver your final JSON response (see Example 6).
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{{
|
|
77
|
+
"profiles": [
|
|
78
|
+
{{
|
|
79
|
+
"content": "the new profile information",
|
|
80
|
+
"time_to_live": "such as one_month"
|
|
81
|
+
}}
|
|
82
|
+
]
|
|
83
|
+
}}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
[Examples With Explanations]
|
|
87
|
+
In each example, the JSON shown is your final response — output it directly as your message.
|
|
88
|
+
|
|
89
|
+
Example 1 - Extracting a new profile:
|
|
90
|
+
- Content definition: "food preferences"
|
|
91
|
+
- Existing profiles: []
|
|
92
|
+
- Interaction: "i like to eat pizza"
|
|
93
|
+
- Reasoning: User revealed a food preference. This is new (not in existing profiles). Food preference changes monthly, so time_to_live is "one_month".
|
|
94
|
+
```json
|
|
95
|
+
{{"profiles": [{{"content": "likes pizza", "time_to_live": "one_month"}}]}}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Example 2 - Extracting a permanent profile:
|
|
99
|
+
- Interaction: "my name is John"
|
|
100
|
+
- Reasoning: User's name is a permanent fact. Use "infinity" for time_to_live.
|
|
101
|
+
```json
|
|
102
|
+
{{"profiles": [{{"content": "name is John", "time_to_live": "infinity"}}]}}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Example 3 - Extracting work context and project:
|
|
106
|
+
- Content definition: "user information"
|
|
107
|
+
- Existing profiles: []
|
|
108
|
+
- Interaction: "I'm a senior backend engineer at Acme Corp, currently migrating our payment service from monolith to microservices. The deadline is end of Q2."
|
|
109
|
+
- Reasoning: Multiple salient facts: role, company, current project, and deadline.
|
|
110
|
+
```json
|
|
111
|
+
{{"profiles": [
|
|
112
|
+
{{"content": "senior backend engineer at Acme Corp", "time_to_live": "one_year"}},
|
|
113
|
+
{{"content": "migrating payment service from monolith to microservices with Q2 deadline", "time_to_live": "one_quarter"}}
|
|
114
|
+
]}}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Example 4 - No relevant information:
|
|
118
|
+
- Content definition: "food preferences"
|
|
119
|
+
- Interaction: "what time is it?"
|
|
120
|
+
- Reasoning: The interaction has nothing to do with food preferences. Return empty.
|
|
121
|
+
```json
|
|
122
|
+
{{"profiles": null}}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Example 5 - Domain / environment fact surfaced through error correction:
|
|
126
|
+
- Content definition: "user information and working environment"
|
|
127
|
+
- Existing profiles: []
|
|
128
|
+
- Interaction: Agent attempts `SUM(orders.total_amount)` and fails with "unknown column 'total_amount'". Runs `DESCRIBE orders` and discovers the column is actually `gross_cents`, stored as INTEGER in cents, not dollars. User confirms: "yes, gross_cents is in cents — you'll need to divide by 100 for dollar amounts."
|
|
129
|
+
- Reasoning: This is a stable fact about the user's data schema (table column name, type, unit) that the agent needs to know for any future revenue query. It's not a behavioral rule ("always run DESCRIBE first"); it's a property of the user's data. Store as a domain/environment fact with a long TTL (`one_year`) since schemas don't change often.
|
|
130
|
+
```json
|
|
131
|
+
{{"profiles": [
|
|
132
|
+
{{"content": "orders.gross_cents stores order revenue as INTEGER in cents (not dollars) — divide by 100 for dollar amounts", "time_to_live": "one_year"}}
|
|
133
|
+
]}}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Note: if the same session surfaces a behavioral rule (e.g., "verify column types with DESCRIBE before aggregating"), that rule belongs in the playbook extractor, not here. This example captures only the fact.
|
|
137
|
+
|
|
138
|
+
Example 6 - `attach_pending_info_request` when the question is already pending, then respond:
|
|
139
|
+
- Interaction: User: "my name is jack — please remember the canonical deployment target for my service. There's an internal standard, but I'm not stating it here."
|
|
140
|
+
- Prior Knowledge contains `pending_tool_call_id: ptc_7f3a91` for the canonical deployment target.
|
|
141
|
+
- Reasoning: Extract "name is jack" now. The canonical deployment target is missing and cannot be derived. Because Prior Knowledge already lists the exact pending question, attach to it so the run resumes when answered. Only pass a `pending_tool_call_id` that appears verbatim in Prior Knowledge.
|
|
142
|
+
- Call `attach_pending_info_request` (a tool call), then respond with the profiles JSON as your final message:
|
|
143
|
+
```json
|
|
144
|
+
{{"pending_tool_call_id": "ptc_7f3a91", "why_relevant": "Same org deployment standard the user wants stored; resume when answered."}}
|
|
145
|
+
```
|
|
146
|
+
```json
|
|
147
|
+
{{"profiles": [{{"content": "name is jack", "time_to_live": "infinity"}}]}}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
[Important Reminders]
|
|
151
|
+
1. Only extract profiles matching the content definition provided above
|
|
152
|
+
2. If the information is already in existing profiles, do NOT re-extract it
|
|
153
|
+
3. Always include time_to_live for new profiles
|
|
154
|
+
4. **Forget / delete / remove requests.** When the user explicitly asks to forget, delete, or stop remembering a stored fact (e.g. "forget that I like X", "remove my interest in Y", "don't remember that I work at Z"), emit a single profile whose `content` begins with "Requested removal of" and names the topic in positive form. Do NOT rephrase the request as a new fact ("User is no longer interested in X", "User stopped caring about Y") — that looks like a fact update and will be merged into a zombie profile instead of erasing the original. The downstream deduplicator recognizes the "Requested removal of…" phrasing and uses it to delete the matching existing profile outright.
|
|
155
|
+
5. Respond with {{"profiles": null}} as your final message if there is nothing to extract
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
active: true
|
|
3
|
+
description: "Assign first-class tags to generated Reflexio entities"
|
|
4
|
+
changelog: "v1.0.0: Initial prompt for post-generation tagging."
|
|
5
|
+
variables:
|
|
6
|
+
- tagging_definition_prompt
|
|
7
|
+
- content
|
|
8
|
+
---
|
|
9
|
+
You assign concise tags to a generated Reflexio entity.
|
|
10
|
+
|
|
11
|
+
Tagging is optional. Only assign a tag when the entity content clearly matches the
|
|
12
|
+
tagging definition below. Do not force, invent, or guess tags, and do not stretch a
|
|
13
|
+
loose association into a tag.
|
|
14
|
+
|
|
15
|
+
Tagging definition:
|
|
16
|
+
{tagging_definition_prompt}
|
|
17
|
+
|
|
18
|
+
Entity content:
|
|
19
|
+
{content}
|
|
20
|
+
|
|
21
|
+
Return the matching tags in the "tags" field, preferring short lowercase tags. If
|
|
22
|
+
nothing in the content matches the tagging definition, return an empty list:
|
|
23
|
+
{{"tags": []}}.
|