claude-smart 0.2.45 → 0.2.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +3 -3
- package/README.md +47 -10
- package/bin/claude-smart.js +535 -23
- package/package.json +22 -3
- package/plugin/.claude-plugin/plugin.json +4 -2
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/README.md +27 -6
- package/plugin/commands/clear-all.md +1 -0
- package/plugin/commands/dashboard.md +1 -0
- package/plugin/commands/learn.md +1 -0
- package/plugin/commands/restart.md +1 -0
- package/plugin/commands/show.md +1 -0
- package/plugin/dashboard/app/configure/env/page.tsx +40 -14
- package/plugin/dashboard/app/configure/server/page.tsx +51 -1
- package/plugin/dashboard/app/layout.tsx +20 -0
- package/plugin/dashboard/app/preferences/[id]/page.tsx +8 -8
- package/plugin/dashboard/app/skills/project/[id]/page.tsx +7 -3
- package/plugin/dashboard/app/skills/shared/[id]/page.tsx +10 -3
- package/plugin/dashboard/lib/claude-settings-file.ts +20 -10
- package/plugin/dashboard/lib/reflexio-client.ts +16 -0
- package/plugin/dashboard/lib/status.ts +10 -3
- package/plugin/dashboard/lib/types.ts +18 -6
- package/plugin/hooks/codex-hooks.json +0 -1
- package/plugin/opencode/assistant-buffer.ts +108 -0
- package/plugin/opencode/dist/assistant-buffer.js +96 -0
- package/plugin/opencode/dist/internal.js +12 -0
- package/plugin/opencode/dist/payload.js +85 -0
- package/plugin/opencode/dist/server.mjs +232 -0
- package/plugin/opencode/internal.ts +18 -0
- package/plugin/opencode/package.json +3 -0
- package/plugin/opencode/payload.ts +90 -0
- package/plugin/opencode/server.mts +251 -0
- package/plugin/opencode/tsconfig.json +13 -0
- package/plugin/pyproject.toml +25 -4
- package/plugin/scripts/_lib.sh +5 -1
- package/plugin/scripts/backend-service.sh +22 -2
- package/plugin/scripts/ensure-plugin-root.sh +4 -4
- package/plugin/scripts/hook_entry.sh +1 -1
- package/plugin/scripts/opencode-claude-compat +4 -0
- package/plugin/scripts/opencode-claude-compat.cmd +3 -0
- package/plugin/scripts/opencode-claude-compat.js +225 -0
- package/plugin/scripts/smart-install.sh +17 -9
- package/plugin/src/README.md +1 -1
- package/plugin/src/claude_smart/cli.py +498 -12
- package/plugin/src/claude_smart/context_format.py +9 -9
- package/plugin/src/claude_smart/cs_cite.py +66 -19
- package/plugin/src/claude_smart/env_config.py +12 -4
- package/plugin/src/claude_smart/events/session_start.py +26 -7
- package/plugin/src/claude_smart/events/stop.py +1 -1
- package/plugin/src/claude_smart/ids.py +1 -1
- package/plugin/src/claude_smart/reflexio_adapter.py +5 -5
- package/plugin/src/claude_smart/runtime.py +7 -1
- package/plugin/uv.lock +5 -5
- package/plugin/vendor/reflexio/.env.example +54 -30
- package/plugin/vendor/reflexio/README.md +17 -11
- package/plugin/vendor/reflexio/pyproject.toml +13 -1
- package/plugin/vendor/reflexio/reflexio/README.md +4 -1
- package/plugin/vendor/reflexio/reflexio/cli/README.md +9 -7
- package/plugin/vendor/reflexio/reflexio/cli/__main__.py +10 -1
- package/plugin/vendor/reflexio/reflexio/cli/bootstrap_config.py +22 -5
- package/plugin/vendor/reflexio/reflexio/cli/commands/interactions.py +34 -4
- package/plugin/vendor/reflexio/reflexio/cli/commands/profiles.py +12 -7
- package/plugin/vendor/reflexio/reflexio/cli/commands/services.py +13 -6
- package/plugin/vendor/reflexio/reflexio/cli/commands/setup_cmd.py +212 -52
- package/plugin/vendor/reflexio/reflexio/cli/commands/shortcuts.py +15 -2
- package/plugin/vendor/reflexio/reflexio/cli/env_loader.py +292 -22
- package/plugin/vendor/reflexio/reflexio/cli/log_format.py +29 -4
- package/plugin/vendor/reflexio/reflexio/cli/run_services.py +17 -8
- package/plugin/vendor/reflexio/reflexio/cli/stop_services.py +13 -10
- package/plugin/vendor/reflexio/reflexio/cli/utils.py +44 -1
- package/plugin/vendor/reflexio/reflexio/client/client.py +154 -13
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/README.md +135 -257
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/npm/openclaw-smart/bin/openclaw-smart.js +13 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/npm/openclaw-smart/package.json +15 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/README.md +38 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/index.ts +151 -110
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/openclaw.plugin.json +20 -10
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/package.json +28 -6
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/pyproject.toml +42 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/_lib.sh +371 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/backend-log-runner.sh +33 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/backend-service.sh +271 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/cli.sh +68 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/dashboard-open.sh +15 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/ensure-plugin-root.sh +84 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/hook_entry.sh +106 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/npm-cli.js +219 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/scripts/smart-install.sh +269 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/skills/clear-all/SKILL.md +8 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/skills/dashboard/SKILL.md +8 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/skills/learn/SKILL.md +10 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/skills/reflexio/SKILL.md +15 -44
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/skills/restart/SKILL.md +6 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/skills/show/SKILL.md +8 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/cli.py +634 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/context_format.py +224 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/context_inject.py +79 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/events/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/events/after_tool_call.py +160 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/events/agent_end.py +187 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/events/before_prompt_build.py +69 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/events/before_tool_call.py +30 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/events/session_end.py +36 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/events/session_start.py +130 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/hook.py +131 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/ids.py +94 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/internal_call.py +75 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/oc_cite.py +196 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/optimizer_assistant.py +272 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/publish.py +96 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/query_compose.py +66 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/reflexio_adapter.py +336 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/runtime.py +47 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/stall_banner.py +61 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/src/openclaw_smart/state.py +323 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/integration/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/integration/test_e2e_session_loop.py +190 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/integration/test_publish_to_local_reflexio_integration.py +112 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/integration/test_recursion_guard_integration.py +86 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/integration/test_search_inject_integration.py +144 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_cli.py +184 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_events_after_tool_call.py +142 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_events_agent_end.py +233 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_events_before_prompt_build.py +116 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_events_before_tool_call.py +35 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_events_session_end.py +47 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_events_session_start.py +109 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_hook_dispatch.py +117 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_ids.py +41 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_internal_call.py +50 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_oc_cite.py +88 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_publish.py +48 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_query_compose.py +48 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_reflexio_adapter.py +188 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_runtime.py +41 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests/test_state.py +235 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests-ts/__mocks__/plugin-entry-stub.ts +6 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests-ts/test_npm_cli.test.ts +56 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tests-ts/test_shim_dispatch.test.ts +171 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/tsconfig.build.json +18 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/{tsconfig.json → plugin/tsconfig.json} +2 -2
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/uv.lock +3835 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/vitest.config.ts +18 -0
- package/plugin/vendor/reflexio/reflexio/lib/_agent_playbook.py +246 -10
- package/plugin/vendor/reflexio/reflexio/lib/_base.py +15 -0
- package/plugin/vendor/reflexio/reflexio/lib/_config.py +11 -4
- package/plugin/vendor/reflexio/reflexio/lib/_generation.py +17 -5
- package/plugin/vendor/reflexio/reflexio/lib/_lineage_parity_readers.py +187 -0
- package/plugin/vendor/reflexio/reflexio/lib/_profiles.py +224 -21
- package/plugin/vendor/reflexio/reflexio/lib/_reflection.py +1 -1
- package/plugin/vendor/reflexio/reflexio/lib/_search.py +52 -25
- package/plugin/vendor/reflexio/reflexio/lib/_user_playbook.py +11 -1
- package/plugin/vendor/reflexio/reflexio/models/api_schema/domain/__init__.py +1 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/domain/entities.py +127 -38
- package/plugin/vendor/reflexio/reflexio/models/api_schema/domain/enums.py +4 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/domain/governance.py +117 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/eval_overview_schema.py +64 -41
- package/plugin/vendor/reflexio/reflexio/models/api_schema/internal_schema.py +19 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/pending_tool_call_schema.py +12 -5
- package/plugin/vendor/reflexio/reflexio/models/api_schema/retriever_schema.py +97 -3
- package/plugin/vendor/reflexio/reflexio/models/api_schema/ui/converters.py +5 -1
- package/plugin/vendor/reflexio/reflexio/models/api_schema/ui/entities.py +5 -1
- package/plugin/vendor/reflexio/reflexio/models/config_schema.py +104 -7
- package/plugin/vendor/reflexio/reflexio/models/structured_output.py +148 -0
- package/plugin/vendor/reflexio/reflexio/server/OVERVIEW.md +3 -3
- package/plugin/vendor/reflexio/reflexio/server/README.md +58 -33
- package/plugin/vendor/reflexio/reflexio/server/__init__.py +29 -5
- package/plugin/vendor/reflexio/reflexio/server/__main__.py +2 -2
- package/plugin/vendor/reflexio/reflexio/server/api.py +899 -103
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/precondition_checks.py +7 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/request_context.py +4 -2
- package/plugin/vendor/reflexio/reflexio/server/auth.py +90 -0
- package/plugin/vendor/reflexio/reflexio/server/billing_meter.py +173 -0
- package/plugin/vendor/reflexio/reflexio/server/billing_signals.py +64 -0
- package/plugin/vendor/reflexio/reflexio/server/cache/reflexio_cache.py +46 -16
- package/plugin/vendor/reflexio/reflexio/server/env_utils.py +65 -0
- package/plugin/vendor/reflexio/reflexio/server/extensions.py +213 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/embedding_service.py +19 -4
- package/plugin/vendor/reflexio/reflexio/server/llm/litellm_client.py +264 -77
- package/plugin/vendor/reflexio/reflexio/server/llm/llm_utils.py +69 -7
- package/plugin/vendor/reflexio/reflexio/server/llm/model_defaults.py +4 -4
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/claude_code_provider.py +1 -1
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/embedding_service_provider.py +75 -16
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/openclaw_provider.py +280 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/rerank/cross_encoder_reranker.py +12 -1
- package/plugin/vendor/reflexio/reflexio/server/llm/token_accounting.py +48 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/tools.py +107 -17
- package/plugin/vendor/reflexio/reflexio/server/operation_limiter.py +360 -4
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.6.0.prompt.md +1 -1
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.7.0.prompt.md +85 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_aggregation/v2.2.0.prompt.md +1 -1
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_aggregation/v2.3.0.prompt.md +253 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.3.2.prompt.md +1 -1
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.3.3.prompt.md +74 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.2.3.prompt.md +1 -1
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.3.0.prompt.md +266 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.4.0.prompt.md +278 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v3.3.0.prompt.md +1 -1
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v3.4.0.prompt.md +137 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main/v1.2.0.prompt.md +1 -1
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main/v1.3.0.prompt.md +34 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_update_instruction_start/v1.0.0.prompt.md +5 -12
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_update_instruction_start/v1.1.0.prompt.md +5 -12
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_update_instruction_start/v1.2.0.prompt.md +155 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/tagging/v1.0.0.prompt.md +23 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_manager.py +89 -32
- package/plugin/vendor/reflexio/reflexio/server/services/README.md +28 -11
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/README.md +22 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/__init__.py +1 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/agent_success_evaluation_constants.py +4 -2
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/agent_success_evaluation_utils.py +1 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/components/__init__.py +7 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/{agent_success_evaluator.py → components/evaluator.py} +3 -16
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/regen_jobs.py +28 -72
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/{group_evaluation_runner.py → runner.py} +12 -10
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/{delayed_group_evaluator.py → scheduler.py} +10 -2
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/{agent_success_evaluation_service.py → service.py} +36 -1
- package/plugin/vendor/reflexio/reflexio/server/services/base_generation_service.py +160 -0
- package/plugin/vendor/reflexio/reflexio/server/services/configurator/base_configurator.py +5 -0
- package/plugin/vendor/reflexio/reflexio/server/services/deduplication_utils.py +1 -1
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/README.md +9 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/components/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/{rule_attribution.py → components/rule_attribution.py} +10 -9
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/eval_sampler.py +15 -24
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/service.py +238 -164
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/README.md +31 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/outcome.py +13 -3
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/pending_tool_call_dispatch.py +3 -2
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/resumable_agent.py +32 -118
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/resume_worker.py +47 -16
- package/plugin/vendor/reflexio/reflexio/server/services/generation_service.py +105 -23
- package/plugin/vendor/reflexio/reflexio/server/services/governance/config.py +52 -0
- package/plugin/vendor/reflexio/reflexio/server/services/governance/service.py +378 -0
- package/plugin/vendor/reflexio/reflexio/server/services/governance/subject_refs.py +34 -0
- package/plugin/vendor/reflexio/reflexio/server/services/lineage/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/services/lineage/gc_scheduler.py +219 -0
- package/plugin/vendor/reflexio/reflexio/server/services/lineage/resolve.py +98 -0
- package/plugin/vendor/reflexio/reflexio/server/services/operation_state_utils.py +26 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/README.md +18 -11
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/aggregation_prompt_processing.py +100 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/components/__init__.py +5 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/{playbook_aggregator.py → components/aggregator.py} +334 -178
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/{playbook_consolidator.py → components/consolidator.py} +168 -62
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/{playbook_extractor.py → components/extractor.py} +5 -1
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_edit_apply.py +74 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_service_utils.py +33 -3
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/{playbook_generation_service.py → service.py} +121 -19
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/README.md +10 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/models.py +2 -1
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/optimizer.py +178 -30
- package/plugin/vendor/reflexio/reflexio/server/services/pre_retrieval/README.md +9 -0
- package/plugin/vendor/reflexio/reflexio/server/services/profile/components/__init__.py +17 -0
- package/plugin/vendor/reflexio/reflexio/server/services/profile/{profile_deduplicator.py → components/consolidator.py} +7 -6
- package/plugin/vendor/reflexio/reflexio/server/services/profile/{profile_extractor.py → components/extractor.py} +31 -22
- package/plugin/vendor/reflexio/reflexio/server/services/profile/profile_generation_service_utils.py +6 -13
- package/plugin/vendor/reflexio/reflexio/server/services/profile/{profile_generation_service.py → service.py} +32 -50
- package/plugin/vendor/reflexio/reflexio/server/services/reflection/__init__.py +4 -8
- package/plugin/vendor/reflexio/reflexio/server/services/reflection/components/__init__.py +7 -0
- package/plugin/vendor/reflexio/reflexio/server/services/reflection/reflection_service_utils.py +12 -1
- package/plugin/vendor/reflexio/reflexio/server/services/reflection/{reflection_service.py → service.py} +36 -16
- package/plugin/vendor/reflexio/reflexio/server/services/retrieval/recency.py +211 -0
- package/plugin/vendor/reflexio/reflexio/server/services/retrieval/relevance_floor.py +99 -6
- package/plugin/vendor/reflexio/reflexio/server/services/service_utils.py +36 -1
- package/plugin/vendor/reflexio/reflexio/server/services/shadow_comparison/README.md +8 -0
- package/plugin/vendor/reflexio/reflexio/server/services/shadow_comparison/outcome.py +1 -2
- package/plugin/vendor/reflexio/reflexio/server/services/storage/error.py +31 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/governance_validation.py +681 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/retention.py +9 -9
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/__init__.py +16 -2
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_agent_run.py +4 -1
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_base.py +644 -197
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_extras.py +106 -119
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_governance.py +1965 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_lineage.py +630 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_operations.py +38 -6
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_playbook.py +31 -1369
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_profiles.py +756 -210
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_requests.py +148 -34
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_shadow_verdicts.py +23 -9
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_stall_state.py +5 -2
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/playbook/__init__.py +13 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/playbook/_agent.py +952 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/playbook/_eval_results.py +189 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/playbook/_optimization.py +247 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/playbook/_source_linkage.py +145 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/playbook/_user.py +838 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/__init__.py +150 -23
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_agent_run.py +2 -8
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_base.py +5 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_extras.py +40 -57
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_governance.py +148 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_lineage.py +215 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_operations.py +20 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_playbook.py +4 -677
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_profiles.py +134 -1
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_requests.py +62 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_retrieval_log.py +51 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_shadow_verdicts.py +17 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/playbook/__init__.py +13 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/playbook/_agent.py +365 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/playbook/_eval_results.py +124 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/playbook/_optimization.py +85 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/playbook/_source_linkage.py +47 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/playbook/_user.py +333 -0
- package/plugin/vendor/reflexio/reflexio/server/services/tagging/README.md +8 -0
- package/plugin/vendor/reflexio/reflexio/server/services/tagging/__init__.py +1 -0
- package/plugin/vendor/reflexio/reflexio/server/services/tagging/service.py +200 -0
- package/plugin/vendor/reflexio/reflexio/server/services/tagging/tagging_scheduler.py +149 -0
- package/plugin/vendor/reflexio/reflexio/server/services/unified_search_service.py +372 -34
- package/plugin/vendor/reflexio/reflexio/server/site_var/README.md +2 -1
- package/plugin/vendor/reflexio/reflexio/server/site_var/feature_flags.py +120 -1
- package/plugin/vendor/reflexio/reflexio/server/site_var/site_var_sources/feature_flags.json +4 -0
- package/plugin/vendor/reflexio/reflexio/server/site_var/site_var_sources/search_settings.json +5 -0
- package/plugin/vendor/reflexio/reflexio/server/tracing.py +30 -0
- package/plugin/vendor/reflexio/reflexio/server/usage_metrics.py +18 -0
- package/plugin/vendor/reflexio/reflexio/test_support/llm_mock.py +61 -26
- package/plugin/vendor/reflexio/reflexio/test_support/llm_model_registry.py +41 -4
- package/scripts/setup-claude-smart.sh +8 -3
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/TESTING.md +0 -517
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/hook/handler.js +0 -473
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/package-lock.json +0 -2156
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/package.json +0 -18
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/hook/handler.ts +0 -241
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/hook/setup.ts +0 -140
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/publish.ts +0 -113
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/search.ts +0 -52
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/server.ts +0 -103
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/sqlite-buffer.ts +0 -156
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/user-id.ts +0 -134
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/rules/reflexio.md +0 -24
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/publish_clawhub.sh +0 -278
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/references/HOOK.md +0 -164
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/scripts/install.sh +0 -36
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/scripts/uninstall.sh +0 -35
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/publish.test.ts +0 -27
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/search.test.ts +0 -31
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/server.test.ts +0 -42
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/setup.test.ts +0 -49
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/sqlite-buffer.test.ts +0 -91
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/user-id.test.ts +0 -50
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/vitest.config.ts +0 -13
- package/plugin/vendor/reflexio/reflexio/server/_auth.py +0 -25
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/group_aggregation.py +0 -192
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/invariants.py +0 -303
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/plan.py +0 -138
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/tools.py +0 -1125
- /package/plugin/vendor/reflexio/reflexio/integrations/{__init__.py → openclaw/plugin/src/openclaw_smart/__init__.py} +0 -0
- /package/plugin/vendor/reflexio/reflexio/integrations/openclaw/{types → plugin/types}/openclaw.d.ts +0 -0
- /package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/{distribution.py → components/distribution.py} +0 -0
- /package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/{hero_state.py → components/hero_state.py} +0 -0
- /package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/{shadow_aggregation.py → components/shadow_aggregation.py} +0 -0
- /package/plugin/vendor/reflexio/reflexio/server/services/reflection/{reflection_extractor.py → components/extractor.py} +0 -0
package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.6.0.prompt.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
active:
|
|
2
|
+
active: false
|
|
3
3
|
description: "Sliding-window critique-and-revise pass over user-profile / user-playbook items the agent cited within the recent interaction window. Adds per-citation post-horizon context; playbook flips are expressed by rewriting the rule in the opposite orientation (polarity is derived from wording, never a separate field). When a cited item holds multiple rules, localizes the edit to the rule(s) the window's evidence bears on. Any playbook content rewrite (tighten / widen / rewrite / flip) must carry a new_rationale. Defaults strongly to no_change."
|
|
4
4
|
changelog: "v1.6.0: add an explicit 'Change profile TTL' revision-mode bullet instructing the model to set new_profile_time_to_live when the window shows the profile's current time-to-live is wrong for the stability of the fact (TTL-only edits remain exempt from the new_rationale rule). Closes an instruction gap: ReflectionDecision already supported new_profile_time_to_live and Hard constraints already allowed ttl on profiles, but Revision modes never told the model to use it. No output schema, variable, or other mode changed. v1.5.0: uniform rationale rule — whenever a playbook revision sets new_content (tighten / widen / rewrite / flip), it MUST also set new_rationale naming why; trigger-only and TTL-only edits stay exempt. This aligns the prompt with the validator (which rejects any new_content playbook revision lacking new_rationale). Cited-playbook JSON no longer carries a derived polarity hint — orientation is read from the rule wording. No output schema, variable, or mode changed."
|
|
5
5
|
variables:
|
package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.7.0.prompt.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
active: true
|
|
3
|
+
description: "Sliding-window critique-and-revise pass over user-profile / user-playbook items the agent cited within the recent interaction window. Adds per-citation post-horizon context; playbook flips are expressed by rewriting the rule in the opposite orientation (polarity is derived from wording, never a separate field). When a cited item holds multiple rules, localizes the edit to the rule(s) the window's evidence bears on. Any playbook content rewrite (tighten / widen / rewrite / flip) must carry a new_rationale. Defaults strongly to no_change except when post-citation evidence directly shows the cited item caused a correction or became stale."
|
|
4
|
+
changelog: "v1.7.0: adds a carve-out from the no_change default when the post-citation window contains explicit correction against a cited rule or same-window evidence that the cited rule is stale. v1.6.0: add an explicit 'Change profile TTL' revision-mode bullet instructing the model to set new_profile_time_to_live when the window shows the profile's current time-to-live is wrong for the stability of the fact (TTL-only edits remain exempt from the new_rationale rule). Closes an instruction gap: ReflectionDecision already supported new_profile_time_to_live and Hard constraints already allowed ttl on profiles, but Revision modes never told the model to use it. No output schema, variable, or other mode changed. v1.5.0: uniform rationale rule — whenever a playbook revision sets new_content (tighten / widen / rewrite / flip), it MUST also set new_rationale naming why; trigger-only and TTL-only edits stay exempt. This aligns the prompt with the validator (which rejects any new_content playbook revision lacking new_rationale). Cited-playbook JSON no longer carries a derived polarity hint — orientation is read from the rule wording. No output schema, variable, or mode changed."
|
|
5
|
+
variables:
|
|
6
|
+
- agent_context
|
|
7
|
+
- window_interactions_json
|
|
8
|
+
- cited_profiles_json
|
|
9
|
+
- cited_user_playbooks_json
|
|
10
|
+
- per_citation_context_json
|
|
11
|
+
---
|
|
12
|
+
You are reviewing how the agent applied a small set of remembered facts and rules across a recent slice of conversation, with the benefit of seeing what happened *after* the agent used them. Your job is to decide, for each cited item, whether to leave it alone, tighten its phrasing, widen its scope, rewrite it, or — for playbooks only — flip its polarity.
|
|
13
|
+
|
|
14
|
+
[Agent context]
|
|
15
|
+
{agent_context}
|
|
16
|
+
|
|
17
|
+
[Recent interaction window (oldest first; each interaction may include `citations` showing which items it relied on)]
|
|
18
|
+
{window_interactions_json}
|
|
19
|
+
|
|
20
|
+
[Per-citation context]
|
|
21
|
+
For each citation below, a JSON object indicating whether we have a full post-citation horizon. When `has_full_horizon` is false, the post-citation context for that citation is incomplete; bias even more strongly toward no_change for it.
|
|
22
|
+
{per_citation_context_json}
|
|
23
|
+
|
|
24
|
+
[Cited user profile rows that are still current]
|
|
25
|
+
{cited_profiles_json}
|
|
26
|
+
|
|
27
|
+
[Cited user playbook rows that are still current]
|
|
28
|
+
For each cited playbook you receive its `content`, `trigger`, and `rationale`. Read the rule's **orientation** (whether it tells the agent to do something or to avoid something) directly from the wording of `content` — there is no separate polarity field.
|
|
29
|
+
{cited_user_playbooks_json}
|
|
30
|
+
|
|
31
|
+
# Decision rules
|
|
32
|
+
|
|
33
|
+
For each cited item above, emit one ReflectionDecision in `decisions`. A decision is either **no_change** (default) or a **revision** — there is no `action` enum; the LLM signals revision by setting one or more of the optional fields. Default is no_change.
|
|
34
|
+
|
|
35
|
+
Apply the **minimal-edit principle** to every revision: make the smallest edit the window demonstrates, preserve the parts of the item the window did not touch, and avoid accreting detail the window does not support.
|
|
36
|
+
|
|
37
|
+
Do not default to `no_change` when the full post-citation window directly shows the cited item caused or survived a correction. If, after the citation, the user explicitly corrects the agent for following or relying on that cited rule, choose the smallest matching revision: flip when the rule points in the wrong direction, rewrite substance when the rule is factually wrong, or tighten when the rule is valid only in a narrower context. Likewise, if same-window code/config/doc changes make the cited rule factually outdated, rewrite or tighten it instead of leaving stale guidance in place. Keep the strong `no_change` default for ambiguous evidence and keep the `has_full_horizon=false` bias unless the correction is explicit in the available context.
|
|
38
|
+
|
|
39
|
+
## Rationale rule for playbook content edits (all modes)
|
|
40
|
+
|
|
41
|
+
Whenever you set `new_content` on a **playbook** revision — for *any* mode: tighten, widen, rewrite, or flip — you MUST also set `new_rationale` naming the window observation (misapplication, pushback, self-correction, external check, outdated fact, failure trap) that motivates the edit. This is a uniform rule across all content edits, not just flips. A `new_content` playbook revision without `new_rationale` is invalid. Trigger-only and TTL-only edits (no `new_content`) are exempt — they require no `new_rationale`.
|
|
42
|
+
|
|
43
|
+
## When a cited item contains multiple rules
|
|
44
|
+
|
|
45
|
+
A cited playbook may hold several rules — a few do/avoid points covering the steps of a task. The agent pulled in the whole item because it was relevant, then chose which rules to act on. Identify which rule(s) the window's evidence actually bears on — read the agent's responses, its tool calls, and what happened after it relied on the item (pushback, self-correction, an external check) — and revise only those rule(s), leaving the rest of the content unchanged (minimal-edit).
|
|
46
|
+
|
|
47
|
+
- If the window does not clearly show which rule was applied or how it fared, return `no_change` rather than editing the wrong rule.
|
|
48
|
+
- When you change a rule's orientation (a "do" rule becomes an "avoid" rule or vice versa), set `new_rationale` naming the failure/observation that motivates the flip.
|
|
49
|
+
|
|
50
|
+
## no_change
|
|
51
|
+
|
|
52
|
+
Set only `target_kind` and `target_id`. Leave every other field null/empty. Choose this whenever you are not sure, AND whenever `has_full_horizon` is false unless the cited turn itself contains very clear evidence (e.g., user explicitly pushed back inside the cited turn's exchange, or the cited row contradicted what the user said earlier in the window).
|
|
53
|
+
|
|
54
|
+
## Revision modes (set the appropriate fields; the LLM does not emit a category label)
|
|
55
|
+
|
|
56
|
+
- **Tighten (substance preserved).** Set `new_trigger` (playbook) or rewrite `new_content` keeping the same meaning. Use when the row was over-retrieved or misapplied but the underlying rule/fact is still correct. Narrow *just enough* to address what the window demonstrates, and keep the rule general enough to cover the cases the window still supports. Do not change orientation. If you set `new_content`, set `new_rationale` (see rule above).
|
|
57
|
+
- **Widen (substance preserved).** Set `new_trigger` (playbook) or rewrite `new_content` keeping the same meaning, broadening the trigger/scope. Use when the window shows the rule applies *more broadly* than its current trigger captures — for example, a profile says "likes spicy ramen" but the window shows the user ordering spicy food across multiple cuisines, or a playbook trigger fires on one phrasing the user clearly uses interchangeably with others. Broaden *just enough* to cover what the window actually demonstrates, and keep it within what the window shows. Do not change orientation. If you set `new_content`, set `new_rationale` (see rule above).
|
|
58
|
+
- **Rewrite substance.** Set `new_content` (and `new_rationale` for playbooks). Use when the row is factually wrong or outdated. Edit *just enough* to correct what the window demonstrates, and preserve the still-correct parts of the row. Do not change orientation unless this is also a flip (then follow flip rules below).
|
|
59
|
+
- **Change profile TTL** (profiles only). Set `new_profile_time_to_live` when the window shows the profile's current time-to-live is wrong for the stability of the fact (e.g. a fact that proved durable should persist longer; a fact that already went stale should expire sooner). Do not also change the profile content unless the window separately demonstrates a content correction. (This is a TTL-only edit when no `new_content` is set — exempt from the `new_rationale` rule.)
|
|
60
|
+
- **Flip orientation** (playbooks only). To flip a rule, **rewrite `new_content`** as the opposite-orientation rule:
|
|
61
|
+
- For a **success → failure** flip, write `new_content` as avoidance guidance starting with `Avoid`, `Do not`, `Don't`, or `Never`.
|
|
62
|
+
- For a **failure → success** flip, write `new_content` as affirmative action guidance.
|
|
63
|
+
Always **set `new_rationale`** naming the failure/observation in the post-citation context that motivates the flip. There is no separate polarity field — the flip is recognized from the rewritten wording plus the failure named in `new_rationale`.
|
|
64
|
+
|
|
65
|
+
Use flip only when the post-citation window shows the cited rule pushed the agent into a failure trap: user pushback against the recommended action, agent self-correction away from it, an external check refuting it, or the user explicitly disliking the outcome.
|
|
66
|
+
|
|
67
|
+
Use no_change when evidence is unclear or absent.
|
|
68
|
+
|
|
69
|
+
# Over-specialization guard (tighten and rewrite)
|
|
70
|
+
|
|
71
|
+
When you tighten or rewrite, edit *just enough* to address what the window demonstrates, and keep the rule applicable to the cases the window still supports. Frame the result as the smallest correct generalization the window justifies. Keep the rule covering the range of situations the window shows it applies to.
|
|
72
|
+
|
|
73
|
+
# Evidence bar for widening
|
|
74
|
+
|
|
75
|
+
Widen only when multiple interactions in the window demonstrate the broader pattern; treat a single occurrence as insufficient and choose no_change instead. Keep the broadened scope within what the window demonstrates.
|
|
76
|
+
|
|
77
|
+
# Hard constraints
|
|
78
|
+
|
|
79
|
+
- Do **not** flip a profile's orientation (profiles have no polarity) — only rewrite/tighten/widen/ttl apply to profiles.
|
|
80
|
+
- Do **not** invent new playbook rules or profile rows. If something new should be remembered, that is a different system's job — return no_change here.
|
|
81
|
+
- Do **not** generalize beyond what the window actually demonstrates.
|
|
82
|
+
- Do **not** propose decisions for items not present in the cited lists above.
|
|
83
|
+
- If both cited lists are empty, return `decisions: []`.
|
|
84
|
+
|
|
85
|
+
Output strictly conforming to the `ReflectionOutput` schema (a JSON object with a single key `decisions`).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
active:
|
|
2
|
+
active: false
|
|
3
3
|
description: "Generates agent playbook entries from user playbook entries by combining them into actionable policies — structured trigger + markdown-bullet content"
|
|
4
4
|
changelog: "v2.2: preserve distinct orientations when merging — never collapse a do-rule and an avoid-rule (opposite orientations) into a single rule; keep both as separate rules in the merged multi-rule content. This replaces the retired mechanical whole-content polarity-bucketing gate (infer_playbook_polarity) in the aggregator; orientation now lives in rule wording and is the model's judgment (Option B). v2.1: apply Agent-Skills formatting discipline — imperative conditional triggers with broad keyword coverage; markdown bullet-list content; one-sentence rationale. Matches extraction prompt v1.4.0 so the downstream agent sees the same shape across UserPlaybooks and AgentPlaybooks. (in-place 2026-05-30: deprecated and removed blocking_issue.)"
|
|
5
5
|
variables:
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
---
|
|
2
|
+
active: true
|
|
3
|
+
description: "Generates agent playbook entries from user playbook entries by combining them into actionable policies — structured trigger + markdown-bullet content"
|
|
4
|
+
changelog: "v2.3.0: adds antecedent-not-reaction trigger guidance so aggregated policies retrieve before the omission or correction has already happened. (in-place 2026-06-18: make consolidated triggers future-user-query-like retrieval keys.) v2.2: preserve distinct orientations when merging — never collapse a do-rule and an avoid-rule (opposite orientations) into a single rule; keep both as separate rules in the merged multi-rule content. This replaces the retired mechanical whole-content polarity-bucketing gate (infer_playbook_polarity) in the aggregator; orientation now lives in rule wording and is the model's judgment (Option B). v2.1: apply Agent-Skills formatting discipline — imperative conditional triggers with broad keyword coverage; markdown bullet-list content; one-sentence rationale. Matches extraction prompt v1.4.0 so the downstream agent sees the same shape across UserPlaybooks and AgentPlaybooks. (in-place 2026-05-30: deprecated and removed blocking_issue.)"
|
|
5
|
+
variables:
|
|
6
|
+
- user_playbooks
|
|
7
|
+
- existing_approved_playbooks
|
|
8
|
+
- aggregation_prompt_extra_instructions
|
|
9
|
+
---
|
|
10
|
+
You are a policy consolidation and normalization engine for an AI agent.
|
|
11
|
+
|
|
12
|
+
You are given:
|
|
13
|
+
- A cluster of raw extracted playbook entries with SIMILAR (but not necessarily identical) triggers
|
|
14
|
+
- A list of existing approved playbook rules (canonical policies)
|
|
15
|
+
|
|
16
|
+
Each raw playbook entry is shown in per-item format with its Content (the primary human-readable description) followed by optional structured fields.
|
|
17
|
+
|
|
18
|
+
Your job is to generate a NEW canonical playbook rule that:
|
|
19
|
+
|
|
20
|
+
- Represents a *real, generalizable agent behavior improvement*
|
|
21
|
+
- Consolidates all items into one coherent policy
|
|
22
|
+
- Covers policy gaps NOT already handled by approved playbooks
|
|
23
|
+
- Prevents recurrence of the same class of agent mistakes
|
|
24
|
+
|
|
25
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
26
|
+
## Input Format
|
|
27
|
+
|
|
28
|
+
Each raw playbook entry is shown as a numbered item:
|
|
29
|
+
|
|
30
|
+
[1]
|
|
31
|
+
Content: "primary human-readable description of the playbook entry"
|
|
32
|
+
Trigger: "when this condition applies"
|
|
33
|
+
Rationale: "reasoning behind the playbook entry" (optional)
|
|
34
|
+
Blocking issue: [kind] details (optional)
|
|
35
|
+
|
|
36
|
+
[2]
|
|
37
|
+
Content: "another playbook entry description"
|
|
38
|
+
Trigger: "another condition"
|
|
39
|
+
...
|
|
40
|
+
|
|
41
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
42
|
+
## Mandatory Deduplication Gate
|
|
43
|
+
|
|
44
|
+
Before writing anything:
|
|
45
|
+
|
|
46
|
+
Does any existing approved playbook already prevent the same class of mistake?
|
|
47
|
+
|
|
48
|
+
If YES -> Output {{"playbook": null}}
|
|
49
|
+
|
|
50
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
51
|
+
## Playbook format (how to shape the output fields)
|
|
52
|
+
|
|
53
|
+
The `trigger`, `content`, and `rationale` fields are the RETRIEVAL key and
|
|
54
|
+
the INSTRUCTION packet the downstream agent reads at runtime. Shape them so
|
|
55
|
+
they work for both roles. These rules mirror the extraction prompt — the
|
|
56
|
+
downstream agent sees the same shape across per-user UserPlaybooks and
|
|
57
|
+
aggregated AgentPlaybooks, so it parses once.
|
|
58
|
+
|
|
59
|
+
### `trigger` — the consolidated retrieval key
|
|
60
|
+
|
|
61
|
+
- Use **imperative conditional phrasing**: "When …", "If …", "For …".
|
|
62
|
+
- Name the **antecedent situation** where a future agent should act before the correction is needed. Do not make the trigger the user's later repair request or the already-failed state.
|
|
63
|
+
- Shape the trigger like the future user-facing question or task request that should retrieve this playbook. Use "When/If/For a user asks..." phrasing when the policy should fire from a user question.
|
|
64
|
+
- Capture the **common theme** across all input triggers, broad enough to
|
|
65
|
+
cover every variation in the cluster but narrow enough to stay actionable.
|
|
66
|
+
- Include domain **keywords** the agent's future queries would naturally
|
|
67
|
+
employ — task, metric, artifact, action, and common synonyms, not just the
|
|
68
|
+
literal conversational vocabulary of the inputs.
|
|
69
|
+
- Do not make the trigger an internal post-hoc event such as "user corrected
|
|
70
|
+
the agent", "data contradicts estimate", or "agent made an error".
|
|
71
|
+
- Keep to **1–2 sentences, 150–300 characters**.
|
|
72
|
+
|
|
73
|
+
Examples:
|
|
74
|
+
|
|
75
|
+
- ❌ `"reviewing code"` — too narrow; misses "PR review", "inline suggestions".
|
|
76
|
+
- ❌ `"when the agent interacts with users"` — too broad; fires on unrelated queries.
|
|
77
|
+
- ❌ `"User provides a data point that contradicts a quantitative estimate the agent just delivered."` — post-hoc; misses the original finance question.
|
|
78
|
+
- ✅ `"When reviewing code — pull requests, inline comments, pre-merge checks, or any code-review activity."`
|
|
79
|
+
- ✅ `"When editing one deployment doc for an env-var, secret, port, or task-definition change."`
|
|
80
|
+
- ✅ `"When a user asks how to estimate total returns, ROI, performance, or cumulative gains for debt funds, hybrid funds, or investments with recurring distributions."`
|
|
81
|
+
- ❌ `"When syncing two deployment docs."`
|
|
82
|
+
|
|
83
|
+
### `content` — the consolidated instruction packet
|
|
84
|
+
|
|
85
|
+
- Format as a **markdown bullet list (`- ...`)** when the policy has
|
|
86
|
+
multiple independent instructions. Take the UNION of bullets across all
|
|
87
|
+
input entries; dedup semantically overlapping ones; preserve the distinct
|
|
88
|
+
ones.
|
|
89
|
+
- **Preserve distinct orientations — never collapse a "do" rule and an
|
|
90
|
+
"avoid" rule into one.** When the inputs include both a positive rule
|
|
91
|
+
("Do …", "Always …") and a negative rule ("Avoid …", "Never …") — even on
|
|
92
|
+
the same broad topic — keep them as **separate bullets** in the merged
|
|
93
|
+
content. A single skill may legitimately hold mixed-orientation rules for
|
|
94
|
+
different sub-aspects of one task (e.g. "Do: announce in the channel" plus
|
|
95
|
+
"Avoid: Friday-afternoon deploys"). Merging an avoidance bullet into a
|
|
96
|
+
do-bullet (or vice versa) silently discards the failure that motivated it.
|
|
97
|
+
Only drop a bullet when another bullet of the **same** orientation already
|
|
98
|
+
covers it. If two rules genuinely contradict each other on the **same**
|
|
99
|
+
situation (the same trigger with opposite advice), prefer leaving them
|
|
100
|
+
under separate, more-specific triggers (return null here so they are not
|
|
101
|
+
forced into one self-contradictory skill) rather than collapsing them.
|
|
102
|
+
- Use a **numbered list (`1. ...`)** only when the order is load-bearing
|
|
103
|
+
(e.g. "run tests, then fix, then review").
|
|
104
|
+
- Each bullet starts with an **imperative verb** ("Flag …", "Prioritize …",
|
|
105
|
+
"Avoid …", "Always …").
|
|
106
|
+
- Each bullet is **self-sufficient** — a reader should understand it
|
|
107
|
+
without the surrounding bullets.
|
|
108
|
+
- When ALL input entries collapse to a single action, a one-sentence
|
|
109
|
+
imperative is fine; don't force bullets for a one-item list.
|
|
110
|
+
- Length budget: simple rules under ~500 characters; complex multi-step
|
|
111
|
+
rules up to ~2000. Never drop a distinct input bullet to hit a budget —
|
|
112
|
+
split into multiple playbooks under different triggers instead.
|
|
113
|
+
|
|
114
|
+
Examples:
|
|
115
|
+
|
|
116
|
+
- ❌ `"The agent should check for missing test coverage, and also it should prioritize type-safety over style nits, and for every suggestion it should explain why the change is better."` — run-on prose; buries the actions.
|
|
117
|
+
- ✅
|
|
118
|
+
```
|
|
119
|
+
- Flag missing test coverage and any new public API without a docstring.
|
|
120
|
+
- Prioritize type-safety and correctness over style nits (line length, whitespace).
|
|
121
|
+
- For every suggested change, explain WHY it is better — not just what to change.
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
When inputs are historical prose entries, **re-shape them into bullets** in
|
|
125
|
+
the output. The aggregation step is the right place to do the upgrade.
|
|
126
|
+
|
|
127
|
+
### `rationale` — one sentence explaining WHY
|
|
128
|
+
|
|
129
|
+
- **One sentence**, synthesized across all inputs' rationales.
|
|
130
|
+
- Explains the motivation behind the rule, not the rule itself.
|
|
131
|
+
- OMIT rather than restate the content in prose.
|
|
132
|
+
|
|
133
|
+
Example:
|
|
134
|
+
|
|
135
|
+
- ✅ `"The user wants to learn the reasoning, not just apply edits."`
|
|
136
|
+
- ❌ `"For every suggested change, explain why it is better."` — that's
|
|
137
|
+
the content, not the rationale.
|
|
138
|
+
|
|
139
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
140
|
+
## Policy Consolidation Rules
|
|
141
|
+
|
|
142
|
+
To create a valid new policy, you must:
|
|
143
|
+
|
|
144
|
+
1. Synthesize all Content descriptions and Rationale summaries into ONE
|
|
145
|
+
clear `content` following the format above — actionable bullets preferred.
|
|
146
|
+
2. Analyze all Trigger conditions and synthesize ONE clear, generalized
|
|
147
|
+
`trigger` that:
|
|
148
|
+
- Captures the common theme across all listed triggers
|
|
149
|
+
- Uses imperative conditional phrasing with broad keyword coverage
|
|
150
|
+
- Is specific enough to be actionable
|
|
151
|
+
- Is general enough to cover all the variations
|
|
152
|
+
3. When input items have Rationale fields, synthesize them into a one-
|
|
153
|
+
sentence consolidated `rationale`; omit if not substantive.
|
|
154
|
+
4. Remove redundant or overlapping actions.
|
|
155
|
+
5. Normalize into a minimal enforceable policy.
|
|
156
|
+
|
|
157
|
+
Note: The Trigger conditions may vary slightly because clustering is based
|
|
158
|
+
on semantic similarity. Your job is to identify the underlying common
|
|
159
|
+
context and express it clearly.
|
|
160
|
+
|
|
161
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
162
|
+
## Privacy and Identifier Generalization
|
|
163
|
+
|
|
164
|
+
Agent playbooks are shared organization-wide rules. They must capture reusable
|
|
165
|
+
agent behavior, not source-user identity or private source context.
|
|
166
|
+
|
|
167
|
+
Apply these rules to all source fields shown to you, including triggers, rationales, and any freeform content or observations in the clustered input:
|
|
168
|
+
|
|
169
|
+
- Never carry user-specific or source-specific direct identifiers into
|
|
170
|
+
`trigger`, `content`, or `rationale`.
|
|
171
|
+
- Direct identifiers include person names; emails; phone numbers; addresses;
|
|
172
|
+
usernames or handles; government, employee, customer, account, ticket, and
|
|
173
|
+
similar exact identifiers; URLs or strings containing values tied to a person,
|
|
174
|
+
account, session, or secret; and named private customers, users, or
|
|
175
|
+
organization-specific people when the exact name is unnecessary for reusable
|
|
176
|
+
behavior.
|
|
177
|
+
{aggregation_prompt_extra_instructions}
|
|
178
|
+
- Preserve the reusable procedure whenever possible by replacing direct
|
|
179
|
+
identifiers with generalized functional roles, resource types, or
|
|
180
|
+
relationships inferred from the clustered source playbooks.
|
|
181
|
+
- Secrets and credentials must not be copied or generalized as values. Remove
|
|
182
|
+
secret values entirely, keeping only the non-secret procedural lesson if one
|
|
183
|
+
remains.
|
|
184
|
+
- Do not turn one user's personal preference into an organization-wide rule
|
|
185
|
+
unless the cluster supports it as shared behavior.
|
|
186
|
+
- If removing or generalizing identifiers leaves no useful reusable agent
|
|
187
|
+
behavior, Return {{"playbook": null}}.
|
|
188
|
+
|
|
189
|
+
## What a Valid Canonical Policy Must Be
|
|
190
|
+
|
|
191
|
+
It MUST:
|
|
192
|
+
- Improve agent behavior globally
|
|
193
|
+
- Be portable across topics and users
|
|
194
|
+
- Be enforceable as default behavior
|
|
195
|
+
- Eliminate the underlying failure class
|
|
196
|
+
- Not duplicate or partially overlap approved playbooks
|
|
197
|
+
|
|
198
|
+
It MUST NOT:
|
|
199
|
+
- Be a paraphrase of a raw rule
|
|
200
|
+
- Encode personal preferences
|
|
201
|
+
- Encode topic-specific behavior
|
|
202
|
+
- Add conversational language
|
|
203
|
+
|
|
204
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
205
|
+
## Final Privacy Self-Check
|
|
206
|
+
|
|
207
|
+
Before returning JSON:
|
|
208
|
+
|
|
209
|
+
- Verify `trigger`, `content`, and `rationale` contain no direct identifiers, secrets, raw contact details, or exact IDs.
|
|
210
|
+
- Verify the rule remains grounded in the clustered source playbooks and reusable
|
|
211
|
+
across users in the organization.
|
|
212
|
+
- If either check fails and cannot be fixed by generalization, Return
|
|
213
|
+
{{"playbook": null}}.
|
|
214
|
+
|
|
215
|
+
## Output Format (Strict JSON)
|
|
216
|
+
|
|
217
|
+
Return a JSON object with the following structure:
|
|
218
|
+
|
|
219
|
+
{{
|
|
220
|
+
"playbook": {{
|
|
221
|
+
"rationale": "1 sentence: why the new policy prevents recurrence (optional)",
|
|
222
|
+
"trigger": "consolidated imperative conditional trigger (required)",
|
|
223
|
+
"content": "markdown bullet list (or single imperative sentence when only one action) — the actionable policy (required)"
|
|
224
|
+
}}
|
|
225
|
+
}}
|
|
226
|
+
|
|
227
|
+
Rules:
|
|
228
|
+
- "rationale" is OPTIONAL — one sentence on the violated expectation and why the policy prevents recurrence
|
|
229
|
+
- "trigger" is REQUIRED — must consolidate all input Trigger conditions into one imperative conditional phrase
|
|
230
|
+
- "content" is REQUIRED — bullet-shaped when multiple actions; single imperative sentence when one
|
|
231
|
+
|
|
232
|
+
If NO playbook should be generated (duplicates existing approved playbooks), return:
|
|
233
|
+
{{"playbook": null}}
|
|
234
|
+
|
|
235
|
+
Examples:
|
|
236
|
+
|
|
237
|
+
{{"playbook": {{"rationale": "The agent assumed GUI workflows for technical users who prefer CLI, causing misaligned tool recommendations.", "trigger": "When assisting technical users with tool selection — CLI vs GUI, package managers, dev tooling, build systems.", "content": "- Ask for CLI preference before recommending GUI workflows.\n- Default to CLI-first suggestions when the user's context signals technical fluency."}}}}
|
|
238
|
+
|
|
239
|
+
{{"playbook": {{"rationale": "The agent jumped to implementation details before the user understood the trade-offs, causing rework.", "trigger": "When users are exploring architecture decisions — design reviews, system-design interviews, tech choice evaluations.", "content": "- Lead with the high-level strategy and trade-offs.\n- Defer implementation steps until the user signals readiness.\n- Surface alternatives before locking in one direction."}}}}
|
|
240
|
+
|
|
241
|
+
{{"playbook": null}}
|
|
242
|
+
|
|
243
|
+
{{"playbook": {{"rationale": "The agent attempted to delete files without proper permissions, risking data loss.", "trigger": "When a user asks to delete shared files, admin-owned resources, or anything requiring elevated permissions.", "content": "- Inform the user that the deletion requires admin approval.\n- Offer to draft the request on their behalf.\n- Do NOT attempt the deletion directly."}}}}
|
|
244
|
+
|
|
245
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
246
|
+
## Existing Approved Playbooks
|
|
247
|
+
{existing_approved_playbooks}
|
|
248
|
+
|
|
249
|
+
## Clustered Raw Playbooks
|
|
250
|
+
{user_playbooks}
|
|
251
|
+
|
|
252
|
+
## Output
|
|
253
|
+
Return only the JSON object as specified above.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
active:
|
|
2
|
+
active: false
|
|
3
3
|
description: "Reconcile newly-extracted playbooks against existing storage. Decides per-candidate whether each one unifies with one-or-more existing rows (growing a coherent multi-rule skill, mixed do/avoid rules allowed), is rejected as redundant against an existing row, should differentiate (refine both triggers), or is independent."
|
|
4
4
|
changelog: "v2.3.2: tightens schema guidance for integer id fields and compact unify content; forbids display-label strings in numeric fields. v2.3.1: replaces schema example-style output prompting with compact format guidance for the four decision shapes. v2.3.0: `unify` now COMPOSES — it may grow a broader multi-rule skill from coherent related fragments (related sub-aspects of one task), not only same-trigger duplicates. A skill MAY hold mixed-polarity rules (do-rules and avoid-rules for different sub-aspects). Replaced the mechanical single-orientation/same-polarity contract with an LLM-judged no-self-contradiction guard: do NOT unify if combining the rules would make the skill contradict itself on the same situation (same trigger/condition with opposite advice) — route those to `differentiate` or `reject_new`. Re-synthesis (fewest/most-general rules, preserve avoid-detail) and the over-budget `differentiate` preference are unchanged. v2.2.0: `unify` re-synthesizes leaner, more general content (MDL / simplify-in-place) instead of concatenating — fewest, most general rules that still cover all inputs; drop redundant/subsumed wording. Asymmetric fidelity: compress/generalize success guidance, but preserve every distinct avoidance/failure detail verbatim — never soften a named pitfall into a vague platitude. Prefer `differentiate` over `unify` when merging would force an over-long, low-cohesion rule. v2.1.0: `unify` no longer emits a `polarity` field — the unified row's orientation is derived from its wording (recommendation vs avoidance) by the apply-path polarity validator. Same-trigger opposite-orientation rules still must not unify; express orientation through the rule wording. v2.0.0: collapsed 5-kind union → 4-kind. `unify` subsumes `duplicate`+`prefer_new`; `reject_new` replaces `prefer_existing`. Output schema is structurally incompatible with v1.x."
|
|
5
5
|
variables:
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
active: true
|
|
3
|
+
description: "Reconcile newly-extracted playbooks against existing storage. Decides per-candidate whether each one unifies with one-or-more existing rows (growing a coherent multi-rule skill, mixed do/avoid rules allowed), is rejected as redundant against an existing row, should differentiate (refine both triggers), or is independent."
|
|
4
|
+
changelog: "v2.3.3: adds antecedent-not-reaction trigger guidance for unified and differentiated triggers. (in-place 2026-06-15: adds concise anti-overmerge guard for concrete operational surfaces; restates the numeric id fields (`superseded_by_existing_id`, `existing_id`, `archive_existing_ids`) as EXISTING list-position integers — e.g. emit `0` for `[EXISTING-0]` — superseding the prior 'bare DB id, labels never valid' framing.) v2.3.2: tightens schema guidance for integer id fields and compact unify content; forbids display-label strings in numeric fields. v2.3.1: replaces schema example-style output prompting with compact format guidance for the four decision shapes. v2.3.0: `unify` now COMPOSES — it may grow a broader multi-rule skill from coherent related fragments (related sub-aspects of one task), not only same-trigger duplicates. A skill MAY hold mixed-polarity rules (do-rules and avoid-rules for different sub-aspects). Replaced the mechanical single-orientation/same-polarity contract with an LLM-judged no-self-contradiction guard: do NOT unify if combining the rules would make the skill contradict itself on the same situation (same trigger/condition with opposite advice) — route those to `differentiate` or `reject_new`. Re-synthesis (fewest/most-general rules, preserve avoid-detail) and the over-budget `differentiate` preference are unchanged. v2.2.0: `unify` re-synthesizes leaner, more general content (MDL / simplify-in-place) instead of concatenating — fewest, most general rules that still cover all inputs; drop redundant/subsumed wording. Asymmetric fidelity: compress/generalize success guidance, but preserve every distinct avoidance/failure detail verbatim — never soften a named pitfall into a vague platitude. Prefer `differentiate` over `unify` when merging would force an over-long, low-cohesion rule. v2.1.0: `unify` no longer emits a `polarity` field — the unified row's orientation is derived from its wording (recommendation vs avoidance) by the apply-path polarity validator. Same-trigger opposite-orientation rules still must not unify; express orientation through the rule wording. v2.0.0: collapsed 5-kind union → 4-kind. `unify` subsumes `duplicate`+`prefer_new`; `reject_new` replaces `prefer_existing`. Output schema is structurally incompatible with v1.x."
|
|
5
|
+
variables:
|
|
6
|
+
- new_playbook_count
|
|
7
|
+
- new_playbooks
|
|
8
|
+
- existing_playbooks
|
|
9
|
+
---
|
|
10
|
+
You are reconciling a set of newly-extracted playbooks against the related existing playbook rows already in storage. For each new candidate, decide its relationship to the existing rows.
|
|
11
|
+
|
|
12
|
+
Each rendered row carries `Content`, `Trigger`, `Rationale`, `Name`, `Source`, and `Last Modified`. Read each rule's orientation (do-this vs avoid-this) directly from its `Content` / `Rationale` wording. A unified skill may hold both do-rules and avoid-rules for different sub-aspects, so do not treat differing orientation alone as a reason not to merge. Use `Trigger` together with the actual situation each rule addresses as the primary keys for comparison.
|
|
13
|
+
|
|
14
|
+
When you write any final `trigger`, `refined_new_trigger`, or `refined_existing_trigger`, frame it as the antecedent situation where a future agent can act before the mistake recurs, not as the user's later repair request. For example, prefer "When editing one AWS deployment doc for an env-var/secret/port change" over "When syncing two AWS deployment docs."
|
|
15
|
+
|
|
16
|
+
[New playbooks (count: {new_playbook_count})]
|
|
17
|
+
{new_playbooks}
|
|
18
|
+
|
|
19
|
+
[Existing related playbooks]
|
|
20
|
+
{existing_playbooks}
|
|
21
|
+
|
|
22
|
+
# Decision kinds
|
|
23
|
+
|
|
24
|
+
Emit exactly one decision per NEW candidate. Each decision is one of:
|
|
25
|
+
|
|
26
|
+
- **unify** — the NEW belongs in the same skill as one or more EXISTING rows. This covers two cases:
|
|
27
|
+
1. **Dedup / supersede** — the NEW is the same rule as an EXISTING row (after merge), or supersedes one (stronger / broader / more specific evidence).
|
|
28
|
+
2. **Compose** — the NEW covers a **related sub-aspect of the same task** as an EXISTING playbook (coherent, not a strict duplicate). Grow a **broader multi-rule skill** by incorporating the fragment as an additional rule, instead of forcing `reject_new`/`independent`.
|
|
29
|
+
|
|
30
|
+
Provide the final `content`, `trigger`, and `rationale`. List which EXISTING ids you're archiving in `archive_existing_ids` (use an empty list when no EXISTING rows are absorbed). A composed skill MAY hold **mixed-polarity rules** — do-rules and avoid-rules together — when they address **different** sub-aspects of the one task (e.g. "Do: announce in the deploy channel" alongside "Avoid: Friday-afternoon deploys"). Only unify fragments that are **genuinely coherent** (same task scope); unrelated fragments are `independent`.
|
|
31
|
+
|
|
32
|
+
- **reject_new** — an EXISTING row already covers NEW or makes NEW redundant. Name the winning EXISTING row's list-position integer via `superseded_by_existing_id` (for `[EXISTING-0]`, emit `0`). Storage-stability tie-break: when same-situation opposite advice is balanced, default here.
|
|
33
|
+
|
|
34
|
+
- **differentiate** — both valid in distinct contexts (typically same trigger, opposite advice, where the contexts differ). Set `refined_new_trigger` and `refined_existing_trigger` to be strictly narrower than the originals AND mutually exclusive.
|
|
35
|
+
|
|
36
|
+
- **independent** — different topic or task from any existing row. Insert NEW with no archive.
|
|
37
|
+
|
|
38
|
+
# How to write a unified skill (re-synthesis, not concatenation)
|
|
39
|
+
|
|
40
|
+
When you `unify`, re-synthesize a single leaner skill. Do not stitch the inputs together.
|
|
41
|
+
|
|
42
|
+
- Produce the **fewest, most general rules that still cover all the inputs**. Generalize the shared behavior into one clear statement; drop wording that is redundant with or subsumed by another input.
|
|
43
|
+
- A skill may carry several rules. When it does, keep each rule a clean, self-contained do-rule or avoid-rule for its own sub-aspect — do not blur distinct rules into one.
|
|
44
|
+
- **Preserve every distinct avoidance/failure detail with high fidelity.** This is asymmetric: compress and generalize the success guidance, but keep each specific failure intact. Never collapse a named pitfall, concrete error, or specific anti-pattern into a vague platitude — carry it forward in its specific form.
|
|
45
|
+
- Preserve concrete operational surfaces (target groups, SGs, health checks, task defs); do not merge fanout rules into generic sweep/audit rules unless those surfaces remain explicit.
|
|
46
|
+
- Keep the final `content` compact enough to store directly. If a unified skill would require lengthy setup history, multiple long command transcripts, or broad background narrative to stay faithful, do not force `unify`; use `differentiate`, `reject_new`, or `independent` according to the decision rules.
|
|
47
|
+
- Prefer **`differentiate` over `unify`** when merging the inputs would force an over-long, low-cohesion skill. Two focused rules that each read cleanly beat one bloated skill that tries to say everything. If you cannot state the merged skill concisely without losing distinct failure detail, that is a signal to `differentiate` (or keep NEW `independent`) rather than `unify`.
|
|
48
|
+
|
|
49
|
+
# The no-self-contradiction guard
|
|
50
|
+
|
|
51
|
+
A skill MAY hold mixed-polarity rules (do-rules and avoid-rules) for **different** sub-aspects. What it must NEVER hold is two rules that **contradict each other on the same situation** — the same trigger/condition paired with opposite advice (e.g. "use `-F`" and "avoid `-F`" for the very same case).
|
|
52
|
+
|
|
53
|
+
- Before you `unify`, ask: *would combining these rules produce a skill that contradicts itself on the same situation?* If yes, do **not** unify — route the pair to `differentiate` (refine the triggers so each rule owns a disjoint situation) or `reject_new` (one rule wins).
|
|
54
|
+
- Mixed polarity across **different** sub-aspects is fine and expected; mixed advice on the **same** sub-aspect is the forbidden case.
|
|
55
|
+
|
|
56
|
+
# Hard constraints
|
|
57
|
+
|
|
58
|
+
- A NEW + EXISTING pair that gives opposite advice on the **same** situation (same trigger) MUST route to `differentiate` or `reject_new` — never `unify` (that would make the skill self-contradict) and never `independent`.
|
|
59
|
+
- `differentiate.refined_new_trigger` and `refined_existing_trigger` MUST be non-empty and strictly narrower than the originals.
|
|
60
|
+
- Numeric id fields MUST contain bare EXISTING list-position integers, not display labels or bracketed row prefixes. For `[EXISTING-0]`, emit `0`; for `[EXISTING-3]`, emit `3`.
|
|
61
|
+
- When in doubt about a same-situation opposite-advice stalemate, default to `reject_new`. Storage stability wins ties.
|
|
62
|
+
|
|
63
|
+
# Output Format Guidance
|
|
64
|
+
|
|
65
|
+
Respond ONLY with a valid JSON object matching `PlaybookConsolidationOutput`: `{{"decisions": [<one decision object for each NEW candidate>]}}`.
|
|
66
|
+
|
|
67
|
+
Each decision object MUST include `kind` and `new_id`. `new_id` is the rendered NEW label string. All EXISTING references use the numeric list-position fields below.
|
|
68
|
+
|
|
69
|
+
- `unify`: include `archive_existing_ids` as a list of EXISTING list-position integers, plus final compact `content`, `trigger`, and `rationale`; optional `reason` may explain the decision.
|
|
70
|
+
- `reject_new`: include `superseded_by_existing_id` as an EXISTING list-position integer only; optional `reason` may explain the decision.
|
|
71
|
+
- `differentiate`: include `existing_id` as an EXISTING list-position integer only, plus non-empty `refined_new_trigger` and `refined_existing_trigger`; optional `reason` may explain the decision.
|
|
72
|
+
- `independent`: include only `kind`, `new_id`, and optional `reason`.
|
|
73
|
+
|
|
74
|
+
Do not emit markdown, prose, comments, chain-of-thought, or top-level keys other than `decisions`. Do not include fields from another decision kind. Do not put any bracketed/list label string into an integer id field.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
active:
|
|
2
|
+
active: false
|
|
3
3
|
description: "Context setting prompt for resumable playbook extraction. Every claim must be grounded in the conversation and generalized to a reusable task context; both requirements apply jointly to Correction SOPs and Success Path Recipes."
|
|
4
4
|
changelog: "v4.2.3: strengthens strict tool-call discipline so plain-text/no-tool responses are explicitly invalid, including empty extraction outcomes. v4.2.2: replaces output examples with compact tool-call and JSON-shape guidance, while preserving the resumable extraction contract. v4.2.1: negative/avoid guidance cannot contradict the final verified implementation or final evaluation. v4.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). v4.1.7: adds resumable extraction guidance, names legacy fallback and malformed-input branches in boundary-change recipes, and avoids a polarity output field. (in-place 2026-05-30: tool-oriented finish_extraction output framing; deprecated and removed blocking_issue.) (in-place 2026-05-30: clarify in the Output Format section that finish_extraction may be preceded by ask_human/attach_pending_info_request; restructure examples into one no-tool example plus a worked ask_human and attach_pending_info_request example; stress that ask_human is rare and reserved for critical missing org-level facts — finish_extraction alone is the norm.) (in-place 2026-05-30: condense the resumable guidance — state finish-required/optional once, replace the duplicated Output Format block with a one-line pointer, and trim example prose.) (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
5
|
variables:
|