claude-smart 0.2.42 → 0.2.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +3 -3
- package/README.md +1 -1
- package/bin/claude-smart.js +2 -2
- package/package.json +9 -3
- package/plugin/.claude-plugin/plugin.json +9 -3
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/README.md +23 -3
- package/plugin/pyproject.toml +3 -3
- package/plugin/scripts/_lib.sh +91 -0
- package/plugin/scripts/backend-service.sh +51 -4
- package/plugin/scripts/cli.sh +3 -1
- package/plugin/scripts/codex-hook.js +72 -4
- package/plugin/scripts/dashboard-build.sh +1 -0
- package/plugin/scripts/dashboard-service.sh +1 -0
- package/plugin/scripts/ensure-plugin-root.sh +1 -0
- package/plugin/scripts/hook_entry.sh +6 -3
- package/plugin/scripts/smart-install.sh +3 -2
- package/plugin/src/README.md +57 -0
- package/plugin/src/claude_smart/context_format.py +11 -12
- package/plugin/src/claude_smart/cs_cite.py +26 -12
- package/plugin/src/claude_smart/ids.py +13 -5
- package/plugin/uv.lock +126 -5
- package/plugin/vendor/reflexio/.env.example +62 -0
- package/plugin/vendor/reflexio/LICENSE +201 -0
- package/plugin/vendor/reflexio/README.md +338 -0
- package/plugin/vendor/reflexio/pyproject.toml +274 -0
- package/plugin/vendor/reflexio/reflexio/README.md +184 -0
- package/plugin/vendor/reflexio/reflexio/__init__.py +166 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/__init__.py +1 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/README.md +109 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/__init__.py +1 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/backends.py +175 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/bench.py +642 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/embed_cache.py +330 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/report.py +317 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/results/report.md +43 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/results/results.json +4478 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/scenarios.py +134 -0
- package/plugin/vendor/reflexio/reflexio/benchmarks/retrieval_latency/seed.py +255 -0
- package/plugin/vendor/reflexio/reflexio/cli/README.md +287 -0
- package/plugin/vendor/reflexio/reflexio/cli/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/cli/__main__.py +56 -0
- package/plugin/vendor/reflexio/reflexio/cli/_client.py +86 -0
- package/plugin/vendor/reflexio/reflexio/cli/app.py +127 -0
- package/plugin/vendor/reflexio/reflexio/cli/bootstrap_config.py +265 -0
- package/plugin/vendor/reflexio/reflexio/cli/codex_auth.py +503 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/admin_cmd.py +65 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/agent_playbooks.py +503 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/api.py +114 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/auth.py +109 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/config_cmd.py +511 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/doctor.py +127 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/embeddings.py +53 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/interactions.py +478 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/profiles.py +303 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/services.py +289 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/setup_cmd.py +964 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/shortcuts.py +285 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/status_cmd.py +143 -0
- package/plugin/vendor/reflexio/reflexio/cli/commands/user_playbooks.py +373 -0
- package/plugin/vendor/reflexio/reflexio/cli/env_loader.py +284 -0
- package/plugin/vendor/reflexio/reflexio/cli/errors.py +217 -0
- package/plugin/vendor/reflexio/reflexio/cli/log_format.py +247 -0
- package/plugin/vendor/reflexio/reflexio/cli/output.py +867 -0
- package/plugin/vendor/reflexio/reflexio/cli/paths.py +41 -0
- package/plugin/vendor/reflexio/reflexio/cli/run_services.py +391 -0
- package/plugin/vendor/reflexio/reflexio/cli/state.py +204 -0
- package/plugin/vendor/reflexio/reflexio/cli/stop_services.py +96 -0
- package/plugin/vendor/reflexio/reflexio/cli/utils.py +329 -0
- package/plugin/vendor/reflexio/reflexio/client/__init__.py +3 -0
- package/plugin/vendor/reflexio/reflexio/client/cache.py +150 -0
- package/plugin/vendor/reflexio/reflexio/client/client.py +2613 -0
- package/plugin/vendor/reflexio/reflexio/defaults.py +23 -0
- package/plugin/vendor/reflexio/reflexio/integrations/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/.clawhubignore +7 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/README.md +274 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/TESTING.md +517 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/hook/handler.js +473 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/package-lock.json +2156 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/package.json +18 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/hook/handler.ts +241 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/hook/setup.ts +140 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/index.ts +130 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/publish.ts +113 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/search.ts +52 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/server.ts +103 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/sqlite-buffer.ts +156 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/lib/user-id.ts +134 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/openclaw.plugin.json +41 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/package.json +17 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/rules/reflexio.md +24 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/plugin/skills/reflexio/SKILL.md +48 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/publish_clawhub.sh +278 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/references/HOOK.md +164 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/scripts/install.sh +36 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/scripts/uninstall.sh +35 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/publish.test.ts +27 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/search.test.ts +31 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/server.test.ts +42 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/setup.test.ts +49 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/sqlite-buffer.test.ts +91 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tests/user-id.test.ts +50 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/tsconfig.json +16 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/types/openclaw.d.ts +230 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw/vitest.config.ts +13 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/README.md +120 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/TESTING.md +168 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/package-lock.json +1657 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/package.json +16 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/HEARTBEAT.md +6 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/README.md +84 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/SKILL.md +194 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/_meta.json +6 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/agents/reflexio-extractor.md +45 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/hook/handler.ts +214 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/hook/setup.ts +55 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/index.ts +327 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/consolidate.ts +233 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/dedup.ts +80 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/io.ts +155 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/openclaw-cli.ts +67 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/search.ts +33 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/write-playbook.ts +76 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/lib/write-profile.ts +79 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/openclaw.plugin.json +46 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/package.json +18 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/prompts/README.md +36 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/prompts/full_consolidation.md +56 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/prompts/playbook_extraction.md +217 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/prompts/profile_extraction.md +132 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/skills/reflexio-consolidate/SKILL.md +33 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/plugin/skills/reflexio-embedded/SKILL.md +194 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/references/HOOK.md +18 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/references/architecture.md +49 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/references/comparison.md +31 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/references/future-work.md +47 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/references/porting-notes.md +52 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/scripts/install.sh +52 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/scripts/uninstall.sh +36 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/consolidate.test.ts +135 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/dedup.test.ts +104 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/io.test.ts +175 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/search.test.ts +66 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/smoke-test.ts +140 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/write-playbook.test.ts +93 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tests/write-profile.test.ts +174 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/tsconfig.json +16 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/types/openclaw.d.ts +230 -0
- package/plugin/vendor/reflexio/reflexio/integrations/openclaw-embedded/vitest.config.ts +7 -0
- package/plugin/vendor/reflexio/reflexio/lib/__init__.py +23 -0
- package/plugin/vendor/reflexio/reflexio/lib/_agent_playbook.py +310 -0
- package/plugin/vendor/reflexio/reflexio/lib/_base.py +225 -0
- package/plugin/vendor/reflexio/reflexio/lib/_config.py +83 -0
- package/plugin/vendor/reflexio/reflexio/lib/_dashboard.py +266 -0
- package/plugin/vendor/reflexio/reflexio/lib/_generation.py +176 -0
- package/plugin/vendor/reflexio/reflexio/lib/_interactions.py +334 -0
- package/plugin/vendor/reflexio/reflexio/lib/_operations.py +153 -0
- package/plugin/vendor/reflexio/reflexio/lib/_profiles.py +545 -0
- package/plugin/vendor/reflexio/reflexio/lib/_reflection.py +52 -0
- package/plugin/vendor/reflexio/reflexio/lib/_search.py +167 -0
- package/plugin/vendor/reflexio/reflexio/lib/_storage_labels.py +103 -0
- package/plugin/vendor/reflexio/reflexio/lib/_user_playbook.py +288 -0
- package/plugin/vendor/reflexio/reflexio/lib/reflexio_lib.py +27 -0
- package/plugin/vendor/reflexio/reflexio/models/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/braintrust_schema.py +141 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/common.py +41 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/domain/__init__.py +3 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/domain/entities.py +1112 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/domain/enums.py +63 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/eval_overview_schema.py +487 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/internal_schema.py +28 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/pending_tool_call_schema.py +83 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/retriever_schema.py +768 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/service_schemas.py +9 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/stall_state_schema.py +32 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/ui/__init__.py +3 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/ui/converters.py +177 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/ui/entities.py +129 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/ui/enums.py +25 -0
- package/plugin/vendor/reflexio/reflexio/models/api_schema/validators.py +333 -0
- package/plugin/vendor/reflexio/reflexio/models/config_schema.py +908 -0
- package/plugin/vendor/reflexio/reflexio/models/py.typed +0 -0
- package/plugin/vendor/reflexio/reflexio/server/OVERVIEW.md +90 -0
- package/plugin/vendor/reflexio/reflexio/server/README.md +622 -0
- package/plugin/vendor/reflexio/reflexio/server/__init__.py +210 -0
- package/plugin/vendor/reflexio/reflexio/server/__main__.py +132 -0
- package/plugin/vendor/reflexio/reflexio/server/_auth.py +25 -0
- package/plugin/vendor/reflexio/reflexio/server/api.py +2868 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/README.md +34 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/account_api.py +143 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/health_api.py +91 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/pending_tool_call_api.py +572 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/precondition_checks.py +66 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/publisher_api.py +562 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/request_context.py +50 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/stall_state_api.py +100 -0
- package/plugin/vendor/reflexio/reflexio/server/cache/__init__.py +15 -0
- package/plugin/vendor/reflexio/reflexio/server/cache/reflexio_cache.py +208 -0
- package/plugin/vendor/reflexio/reflexio/server/correlation.py +46 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/__init__.py +30 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/embedding_service.py +359 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/image_utils.py +55 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/litellm_client.py +1871 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/llm_utils.py +140 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/model_defaults.py +479 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/__init__.py +1 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/claude_code_provider.py +1122 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/claude_code_stream_parser.py +197 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/embedding_service_provider.py +338 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/local_embedding_provider.py +213 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/nomic_embedding_provider.py +288 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/rerank/__init__.py +6 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/rerank/cross_encoder_reranker.py +187 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/rerank/llm_reranker.py +148 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/tools.py +716 -0
- package/plugin/vendor/reflexio/reflexio/server/operation_limiter.py +179 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/_dispatchers.py +54 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/README.md +121 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/agent_success_evaluation/v1.0.0.prompt.md +58 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/agent_success_evaluation_with_comparison/v1.0.0.prompt.md +76 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/answer_synthesis/v1.5.2.prompt.md +88 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/compress_session_for_query/v1.3.0.prompt.md +31 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/document_expansion/v1.0.0.prompt.md +20 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.0.0.prompt.md +53 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.1.0.prompt.md +57 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.2.0.prompt.md +68 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.3.0.prompt.md +70 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.4.0.prompt.md +77 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.5.0.prompt.md +82 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/memory_reflection/v1.6.0.prompt.md +83 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_aggregation/v2.1.0.prompt.md +193 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_aggregation/v2.2.0.prompt.md +206 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v1.0.0-deprecated.prompt.md +66 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v1.0.0.prompt.md +43 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v1.1.0.prompt.md +46 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.0.0-deprecated.prompt.md +64 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.0.0.prompt.md +39 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.1.0.prompt.md +39 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.2.0.prompt.md +47 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.3.0.prompt.md +58 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.3.1.prompt.md +69 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.3.2.prompt.md +71 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.0.2.prompt.md +254 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.1.0.prompt.md +274 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.2.0.prompt.md +283 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.2.2.prompt.md +234 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context/v4.2.3.prompt.md +244 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v1.0.0.prompt.md +73 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v2.0.0.prompt.md +86 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v3.0.0.prompt.md +97 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v3.1.0.prompt.md +119 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v3.2.0.prompt.md +123 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_context_expert/v3.3.0.prompt.md +137 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main/v1.0.0.prompt.md +14 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main/v1.1.0.prompt.md +24 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main/v1.2.0.prompt.md +29 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main_expert/v1.0.0.prompt.md +11 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main_expert/v1.1.0.prompt.md +21 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_extraction_main_expert/v1.2.0.prompt.md +25 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_optimizer_judge/v1.0.0.prompt.md +37 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_optimizer_judge/v1.1.0.prompt.md +40 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_optimizer_judge/v1.2.0.prompt.md +36 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_should_generate/v1.0.0.prompt.md +45 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_should_generate/v2.0.0.prompt.md +81 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_should_generate/v3.0.0.prompt.md +80 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_should_generate_expert/v1.0.0.prompt.md +34 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_deduplication/v1.0.0.prompt.md +116 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_should_generate/v1.0.0.prompt.md +33 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_should_generate_override/v1.0.0.prompt.md +16 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_update_instruction_start/v1.0.0.prompt.md +140 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_update_instruction_start/v1.1.0.prompt.md +160 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/profile_update_main/v1.0.0.prompt.md +14 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/query_reformulation/v1.0.0.prompt.md +19 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/rerank_relevance/v1.1.0.prompt.md +44 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/shadow_comparison/v1.0.0.prompt.md +43 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/shadow_content_evaluation/v1.0.0.prompt.md +33 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_evaluation/prompt_evaluation_dataset/feedback_extraction_main_v1.jsonl +10 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_evaluation/prompt_evaluation_dataset/profile_update_main_v1.jsonl +10 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_manager.py +280 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_schema.py +11 -0
- package/plugin/vendor/reflexio/reflexio/server/services/README.md +58 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/_eval_health.py +131 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/agent_success_evaluation_constants.py +60 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/agent_success_evaluation_service.py +228 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/agent_success_evaluation_utils.py +87 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/agent_success_evaluator.py +372 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/delayed_group_evaluator.py +156 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/group_evaluation_runner.py +336 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/regen_jobs.py +471 -0
- package/plugin/vendor/reflexio/reflexio/server/services/base_generation_service.py +1668 -0
- package/plugin/vendor/reflexio/reflexio/server/services/braintrust/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/services/braintrust/_cron.py +196 -0
- package/plugin/vendor/reflexio/reflexio/server/services/braintrust/_encryption.py +101 -0
- package/plugin/vendor/reflexio/reflexio/server/services/braintrust/client.py +167 -0
- package/plugin/vendor/reflexio/reflexio/server/services/braintrust/service.py +281 -0
- package/plugin/vendor/reflexio/reflexio/server/services/configurator/base_configurator.py +179 -0
- package/plugin/vendor/reflexio/reflexio/server/services/configurator/config_storage.py +62 -0
- package/plugin/vendor/reflexio/reflexio/server/services/configurator/configurator.py +87 -0
- package/plugin/vendor/reflexio/reflexio/server/services/configurator/local_file_config_storage.py +187 -0
- package/plugin/vendor/reflexio/reflexio/server/services/configurator/test_config_storage.py +162 -0
- package/plugin/vendor/reflexio/reflexio/server/services/deduplication_utils.py +112 -0
- package/plugin/vendor/reflexio/reflexio/server/services/embedding_text.py +62 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/distribution.py +33 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/eval_sampler.py +126 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/group_aggregation.py +192 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/hero_state.py +75 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/rule_attribution.py +97 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/service.py +515 -0
- package/plugin/vendor/reflexio/reflexio/server/services/evaluation_overview/shadow_aggregation.py +90 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/agent_run_records.py +91 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/invariants.py +303 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/outcome.py +25 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/pending_tool_call_dispatch.py +358 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/plan.py +138 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/prior_answer_search.py +217 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/resumable_agent.py +535 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/resume_scheduler.py +171 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/resume_worker.py +779 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/tools.py +1125 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extractor_config_utils.py +94 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extractor_interaction_utils.py +251 -0
- package/plugin/vendor/reflexio/reflexio/server/services/generation_service.py +702 -0
- package/plugin/vendor/reflexio/reflexio/server/services/operation_state_utils.py +835 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/README.md +89 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_aggregator.py +1388 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_consolidator.py +1045 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_extractor.py +436 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_generation_service.py +808 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_service_constants.py +28 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_service_utils.py +362 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/__init__.py +24 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/assistant_webhook.py +246 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/gepa_adapter.py +291 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/judge.py +97 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/models.py +96 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/optimizer.py +645 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/rollout.py +35 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/scenario_resolver.py +93 -0
- package/plugin/vendor/reflexio/reflexio/server/services/playbook_optimizer/scheduler.py +174 -0
- package/plugin/vendor/reflexio/reflexio/server/services/pre_retrieval/__init__.py +26 -0
- package/plugin/vendor/reflexio/reflexio/server/services/pre_retrieval/_document_expander.py +179 -0
- package/plugin/vendor/reflexio/reflexio/server/services/pre_retrieval/_query_reformulator.py +297 -0
- package/plugin/vendor/reflexio/reflexio/server/services/profile/profile_deduplicator.py +772 -0
- package/plugin/vendor/reflexio/reflexio/server/services/profile/profile_extractor.py +462 -0
- package/plugin/vendor/reflexio/reflexio/server/services/profile/profile_generation_service.py +737 -0
- package/plugin/vendor/reflexio/reflexio/server/services/profile/profile_generation_service_utils.py +290 -0
- package/plugin/vendor/reflexio/reflexio/server/services/reflection/__init__.py +17 -0
- package/plugin/vendor/reflexio/reflexio/server/services/reflection/reflection_extractor.py +247 -0
- package/plugin/vendor/reflexio/reflexio/server/services/reflection/reflection_service.py +803 -0
- package/plugin/vendor/reflexio/reflexio/server/services/reflection/reflection_service_utils.py +146 -0
- package/plugin/vendor/reflexio/reflexio/server/services/retrieval/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/services/retrieval/relevance_floor.py +80 -0
- package/plugin/vendor/reflexio/reflexio/server/services/search/__init__.py +0 -0
- package/plugin/vendor/reflexio/reflexio/server/services/service_utils.py +756 -0
- package/plugin/vendor/reflexio/reflexio/server/services/shadow_comparison/__init__.py +1 -0
- package/plugin/vendor/reflexio/reflexio/server/services/shadow_comparison/judge.py +184 -0
- package/plugin/vendor/reflexio/reflexio/server/services/shadow_comparison/outcome.py +81 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/constants.py +2 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/error.py +11 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/retention.py +154 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/retention_mixin.py +155 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/__init__.py +59 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_agent_run.py +1298 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_base.py +1945 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_extras.py +600 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_operations.py +346 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_playbook.py +1378 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_profiles.py +747 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_requests.py +263 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_shadow_verdicts.py +193 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_share_links.py +166 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_stall_state.py +217 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/__init__.py +153 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_agent_run.py +384 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_base.py +71 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_extras.py +235 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_operations.py +170 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_playbook.py +677 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_profiles.py +250 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_requests.py +154 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_shadow_verdicts.py +130 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_share_links.py +93 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_stall_state.py +76 -0
- package/plugin/vendor/reflexio/reflexio/server/services/unified_search_service.py +572 -0
- package/plugin/vendor/reflexio/reflexio/server/site_var/README.md +77 -0
- package/plugin/vendor/reflexio/reflexio/server/site_var/feature_flags.py +116 -0
- package/plugin/vendor/reflexio/reflexio/server/site_var/site_var_manager.py +263 -0
- package/plugin/vendor/reflexio/reflexio/server/site_var/site_var_sources/feature_flags.json +13 -0
- package/plugin/vendor/reflexio/reflexio/server/site_var/site_var_sources/llm_model_setting.json +7 -0
- package/plugin/vendor/reflexio/reflexio/server/tracing.py +158 -0
- package/plugin/vendor/reflexio/reflexio/server/usage_metrics.py +113 -0
- package/plugin/vendor/reflexio/reflexio/server/uvicorn_logging.py +76 -0
- package/plugin/vendor/reflexio/reflexio/test_support/__init__.py +1 -0
- package/plugin/vendor/reflexio/reflexio/test_support/llm_fixtures.py +62 -0
- package/plugin/vendor/reflexio/reflexio/test_support/llm_mock.py +242 -0
- package/plugin/vendor/reflexio/reflexio/test_support/llm_model_registry.py +129 -0
- package/plugin/vendor/reflexio/reflexio/test_support/skip_decorators.py +43 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
---
|
|
2
|
+
active: false
|
|
3
|
+
description: "Generates agent playbook entries from user playbook entries by combining them into actionable policies — structured trigger + markdown-bullet content"
|
|
4
|
+
changelog: "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
|
+
---
|
|
9
|
+
You are a policy consolidation and normalization engine for an AI agent.
|
|
10
|
+
|
|
11
|
+
You are given:
|
|
12
|
+
- A cluster of raw extracted playbook entries with SIMILAR (but not necessarily identical) triggers
|
|
13
|
+
- A list of existing approved playbook rules (canonical policies)
|
|
14
|
+
|
|
15
|
+
Each raw playbook entry is shown in per-item format with its Content (the primary human-readable description) followed by optional structured fields.
|
|
16
|
+
|
|
17
|
+
Your job is to generate a NEW canonical playbook rule that:
|
|
18
|
+
|
|
19
|
+
- Represents a *real, generalizable agent behavior improvement*
|
|
20
|
+
- Consolidates all items into one coherent policy
|
|
21
|
+
- Covers policy gaps NOT already handled by approved playbooks
|
|
22
|
+
- Prevents recurrence of the same class of agent mistakes
|
|
23
|
+
|
|
24
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
25
|
+
## Input Format
|
|
26
|
+
|
|
27
|
+
Each raw playbook entry is shown as a numbered item:
|
|
28
|
+
|
|
29
|
+
[1]
|
|
30
|
+
Content: "primary human-readable description of the playbook entry"
|
|
31
|
+
Trigger: "when this condition applies"
|
|
32
|
+
Rationale: "reasoning behind the playbook entry" (optional)
|
|
33
|
+
Blocking issue: [kind] details (optional)
|
|
34
|
+
|
|
35
|
+
[2]
|
|
36
|
+
Content: "another playbook entry description"
|
|
37
|
+
Trigger: "another condition"
|
|
38
|
+
...
|
|
39
|
+
|
|
40
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
41
|
+
## Mandatory Deduplication Gate
|
|
42
|
+
|
|
43
|
+
Before writing anything:
|
|
44
|
+
|
|
45
|
+
Does any existing approved playbook already prevent the same class of mistake?
|
|
46
|
+
|
|
47
|
+
If YES -> Output {{"playbook": null}}
|
|
48
|
+
|
|
49
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
50
|
+
## Playbook format (how to shape the output fields)
|
|
51
|
+
|
|
52
|
+
The `trigger`, `content`, and `rationale` fields are the RETRIEVAL key and
|
|
53
|
+
the INSTRUCTION packet the downstream agent reads at runtime. Shape them so
|
|
54
|
+
they work for both roles. These rules mirror the extraction prompt — the
|
|
55
|
+
downstream agent sees the same shape across per-user UserPlaybooks and
|
|
56
|
+
aggregated AgentPlaybooks, so it parses once.
|
|
57
|
+
|
|
58
|
+
### `trigger` — the consolidated retrieval key
|
|
59
|
+
|
|
60
|
+
- Use **imperative conditional phrasing**: "When …", "If …", "For …".
|
|
61
|
+
- Capture the **common theme** across all input triggers, broad enough to
|
|
62
|
+
cover every variation in the cluster but narrow enough to stay actionable.
|
|
63
|
+
- Include domain **keywords** the agent's future queries would naturally
|
|
64
|
+
employ — not just the literal conversational vocabulary of the inputs.
|
|
65
|
+
- Keep to **1–2 sentences, 150–300 characters**.
|
|
66
|
+
|
|
67
|
+
Examples:
|
|
68
|
+
|
|
69
|
+
- ❌ `"reviewing code"` — too narrow; misses "PR review", "inline suggestions".
|
|
70
|
+
- ❌ `"when the agent interacts with users"` — too broad; fires on unrelated queries.
|
|
71
|
+
- ✅ `"When reviewing code — pull requests, inline comments, pre-merge checks, or any code-review activity."`
|
|
72
|
+
|
|
73
|
+
### `content` — the consolidated instruction packet
|
|
74
|
+
|
|
75
|
+
- Format as a **markdown bullet list (`- ...`)** when the policy has
|
|
76
|
+
multiple independent instructions. Take the UNION of bullets across all
|
|
77
|
+
input entries; dedup semantically overlapping ones; preserve the distinct
|
|
78
|
+
ones.
|
|
79
|
+
- Use a **numbered list (`1. ...`)** only when the order is load-bearing
|
|
80
|
+
(e.g. "run tests, then fix, then review").
|
|
81
|
+
- Each bullet starts with an **imperative verb** ("Flag …", "Prioritize …",
|
|
82
|
+
"Avoid …", "Always …").
|
|
83
|
+
- Each bullet is **self-sufficient** — a reader should understand it
|
|
84
|
+
without the surrounding bullets.
|
|
85
|
+
- When ALL input entries collapse to a single action, a one-sentence
|
|
86
|
+
imperative is fine; don't force bullets for a one-item list.
|
|
87
|
+
- Length budget: simple rules under ~500 characters; complex multi-step
|
|
88
|
+
rules up to ~2000. Never drop a distinct input bullet to hit a budget —
|
|
89
|
+
split into multiple playbooks under different triggers instead.
|
|
90
|
+
|
|
91
|
+
Examples:
|
|
92
|
+
|
|
93
|
+
- ❌ `"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.
|
|
94
|
+
- ✅
|
|
95
|
+
```
|
|
96
|
+
- Flag missing test coverage and any new public API without a docstring.
|
|
97
|
+
- Prioritize type-safety and correctness over style nits (line length, whitespace).
|
|
98
|
+
- For every suggested change, explain WHY it is better — not just what to change.
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
When inputs are historical prose entries, **re-shape them into bullets** in
|
|
102
|
+
the output. The aggregation step is the right place to do the upgrade.
|
|
103
|
+
|
|
104
|
+
### `rationale` — one sentence explaining WHY
|
|
105
|
+
|
|
106
|
+
- **One sentence**, synthesized across all inputs' rationales.
|
|
107
|
+
- Explains the motivation behind the rule, not the rule itself.
|
|
108
|
+
- OMIT rather than restate the content in prose.
|
|
109
|
+
|
|
110
|
+
Example:
|
|
111
|
+
|
|
112
|
+
- ✅ `"The user wants to learn the reasoning, not just apply edits."`
|
|
113
|
+
- ❌ `"For every suggested change, explain why it is better."` — that's
|
|
114
|
+
the content, not the rationale.
|
|
115
|
+
|
|
116
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
117
|
+
## Policy Consolidation Rules
|
|
118
|
+
|
|
119
|
+
To create a valid new policy, you must:
|
|
120
|
+
|
|
121
|
+
1. Synthesize all Content descriptions and Rationale summaries into ONE
|
|
122
|
+
clear `content` following the format above — actionable bullets preferred.
|
|
123
|
+
2. Analyze all Trigger conditions and synthesize ONE clear, generalized
|
|
124
|
+
`trigger` that:
|
|
125
|
+
- Captures the common theme across all listed triggers
|
|
126
|
+
- Uses imperative conditional phrasing with broad keyword coverage
|
|
127
|
+
- Is specific enough to be actionable
|
|
128
|
+
- Is general enough to cover all the variations
|
|
129
|
+
3. When input items have Rationale fields, synthesize them into a one-
|
|
130
|
+
sentence consolidated `rationale`; omit if not substantive.
|
|
131
|
+
4. Remove redundant or overlapping actions.
|
|
132
|
+
5. Normalize into a minimal enforceable policy.
|
|
133
|
+
|
|
134
|
+
Note: The Trigger conditions may vary slightly because clustering is based
|
|
135
|
+
on semantic similarity. Your job is to identify the underlying common
|
|
136
|
+
context and express it clearly.
|
|
137
|
+
|
|
138
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
139
|
+
## What a Valid Canonical Policy Must Be
|
|
140
|
+
|
|
141
|
+
It MUST:
|
|
142
|
+
- Improve agent behavior globally
|
|
143
|
+
- Be portable across topics and users
|
|
144
|
+
- Be enforceable as default behavior
|
|
145
|
+
- Eliminate the underlying failure class
|
|
146
|
+
- Not duplicate or partially overlap approved playbooks
|
|
147
|
+
|
|
148
|
+
It MUST NOT:
|
|
149
|
+
- Be a paraphrase of a raw rule
|
|
150
|
+
- Encode personal preferences
|
|
151
|
+
- Encode topic-specific behavior
|
|
152
|
+
- Add conversational language
|
|
153
|
+
|
|
154
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
155
|
+
## Output Format (Strict JSON)
|
|
156
|
+
|
|
157
|
+
Return a JSON object with the following structure:
|
|
158
|
+
|
|
159
|
+
{{
|
|
160
|
+
"playbook": {{
|
|
161
|
+
"rationale": "1 sentence: why the new policy prevents recurrence (optional)",
|
|
162
|
+
"trigger": "consolidated imperative conditional trigger (required)",
|
|
163
|
+
"content": "markdown bullet list (or single imperative sentence when only one action) — the actionable policy (required)"
|
|
164
|
+
}}
|
|
165
|
+
}}
|
|
166
|
+
|
|
167
|
+
Rules:
|
|
168
|
+
- "rationale" is OPTIONAL — one sentence on the violated expectation and why the policy prevents recurrence
|
|
169
|
+
- "trigger" is REQUIRED — must consolidate all input Trigger conditions into one imperative conditional phrase
|
|
170
|
+
- "content" is REQUIRED — bullet-shaped when multiple actions; single imperative sentence when one
|
|
171
|
+
|
|
172
|
+
If NO playbook should be generated (duplicates existing approved playbooks), return:
|
|
173
|
+
{{"playbook": null}}
|
|
174
|
+
|
|
175
|
+
Examples:
|
|
176
|
+
|
|
177
|
+
{{"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."}}}}
|
|
178
|
+
|
|
179
|
+
{{"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."}}}}
|
|
180
|
+
|
|
181
|
+
{{"playbook": null}}
|
|
182
|
+
|
|
183
|
+
{{"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."}}}}
|
|
184
|
+
|
|
185
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
186
|
+
## Existing Approved Playbooks
|
|
187
|
+
{existing_approved_playbooks}
|
|
188
|
+
|
|
189
|
+
## Clustered Raw Playbooks
|
|
190
|
+
{user_playbooks}
|
|
191
|
+
|
|
192
|
+
## Output
|
|
193
|
+
Return only the JSON object as specified above.
|
|
@@ -0,0 +1,206 @@
|
|
|
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.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
|
+
---
|
|
9
|
+
You are a policy consolidation and normalization engine for an AI agent.
|
|
10
|
+
|
|
11
|
+
You are given:
|
|
12
|
+
- A cluster of raw extracted playbook entries with SIMILAR (but not necessarily identical) triggers
|
|
13
|
+
- A list of existing approved playbook rules (canonical policies)
|
|
14
|
+
|
|
15
|
+
Each raw playbook entry is shown in per-item format with its Content (the primary human-readable description) followed by optional structured fields.
|
|
16
|
+
|
|
17
|
+
Your job is to generate a NEW canonical playbook rule that:
|
|
18
|
+
|
|
19
|
+
- Represents a *real, generalizable agent behavior improvement*
|
|
20
|
+
- Consolidates all items into one coherent policy
|
|
21
|
+
- Covers policy gaps NOT already handled by approved playbooks
|
|
22
|
+
- Prevents recurrence of the same class of agent mistakes
|
|
23
|
+
|
|
24
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
25
|
+
## Input Format
|
|
26
|
+
|
|
27
|
+
Each raw playbook entry is shown as a numbered item:
|
|
28
|
+
|
|
29
|
+
[1]
|
|
30
|
+
Content: "primary human-readable description of the playbook entry"
|
|
31
|
+
Trigger: "when this condition applies"
|
|
32
|
+
Rationale: "reasoning behind the playbook entry" (optional)
|
|
33
|
+
Blocking issue: [kind] details (optional)
|
|
34
|
+
|
|
35
|
+
[2]
|
|
36
|
+
Content: "another playbook entry description"
|
|
37
|
+
Trigger: "another condition"
|
|
38
|
+
...
|
|
39
|
+
|
|
40
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
41
|
+
## Mandatory Deduplication Gate
|
|
42
|
+
|
|
43
|
+
Before writing anything:
|
|
44
|
+
|
|
45
|
+
Does any existing approved playbook already prevent the same class of mistake?
|
|
46
|
+
|
|
47
|
+
If YES -> Output {{"playbook": null}}
|
|
48
|
+
|
|
49
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
50
|
+
## Playbook format (how to shape the output fields)
|
|
51
|
+
|
|
52
|
+
The `trigger`, `content`, and `rationale` fields are the RETRIEVAL key and
|
|
53
|
+
the INSTRUCTION packet the downstream agent reads at runtime. Shape them so
|
|
54
|
+
they work for both roles. These rules mirror the extraction prompt — the
|
|
55
|
+
downstream agent sees the same shape across per-user UserPlaybooks and
|
|
56
|
+
aggregated AgentPlaybooks, so it parses once.
|
|
57
|
+
|
|
58
|
+
### `trigger` — the consolidated retrieval key
|
|
59
|
+
|
|
60
|
+
- Use **imperative conditional phrasing**: "When …", "If …", "For …".
|
|
61
|
+
- Capture the **common theme** across all input triggers, broad enough to
|
|
62
|
+
cover every variation in the cluster but narrow enough to stay actionable.
|
|
63
|
+
- Include domain **keywords** the agent's future queries would naturally
|
|
64
|
+
employ — not just the literal conversational vocabulary of the inputs.
|
|
65
|
+
- Keep to **1–2 sentences, 150–300 characters**.
|
|
66
|
+
|
|
67
|
+
Examples:
|
|
68
|
+
|
|
69
|
+
- ❌ `"reviewing code"` — too narrow; misses "PR review", "inline suggestions".
|
|
70
|
+
- ❌ `"when the agent interacts with users"` — too broad; fires on unrelated queries.
|
|
71
|
+
- ✅ `"When reviewing code — pull requests, inline comments, pre-merge checks, or any code-review activity."`
|
|
72
|
+
|
|
73
|
+
### `content` — the consolidated instruction packet
|
|
74
|
+
|
|
75
|
+
- Format as a **markdown bullet list (`- ...`)** when the policy has
|
|
76
|
+
multiple independent instructions. Take the UNION of bullets across all
|
|
77
|
+
input entries; dedup semantically overlapping ones; preserve the distinct
|
|
78
|
+
ones.
|
|
79
|
+
- **Preserve distinct orientations — never collapse a "do" rule and an
|
|
80
|
+
"avoid" rule into one.** When the inputs include both a positive rule
|
|
81
|
+
("Do …", "Always …") and a negative rule ("Avoid …", "Never …") — even on
|
|
82
|
+
the same broad topic — keep them as **separate bullets** in the merged
|
|
83
|
+
content. A single skill may legitimately hold mixed-orientation rules for
|
|
84
|
+
different sub-aspects of one task (e.g. "Do: announce in the channel" plus
|
|
85
|
+
"Avoid: Friday-afternoon deploys"). Merging an avoidance bullet into a
|
|
86
|
+
do-bullet (or vice versa) silently discards the failure that motivated it.
|
|
87
|
+
Only drop a bullet when another bullet of the **same** orientation already
|
|
88
|
+
covers it. If two rules genuinely contradict each other on the **same**
|
|
89
|
+
situation (the same trigger with opposite advice), prefer leaving them
|
|
90
|
+
under separate, more-specific triggers (return null here so they are not
|
|
91
|
+
forced into one self-contradictory skill) rather than collapsing them.
|
|
92
|
+
- Use a **numbered list (`1. ...`)** only when the order is load-bearing
|
|
93
|
+
(e.g. "run tests, then fix, then review").
|
|
94
|
+
- Each bullet starts with an **imperative verb** ("Flag …", "Prioritize …",
|
|
95
|
+
"Avoid …", "Always …").
|
|
96
|
+
- Each bullet is **self-sufficient** — a reader should understand it
|
|
97
|
+
without the surrounding bullets.
|
|
98
|
+
- When ALL input entries collapse to a single action, a one-sentence
|
|
99
|
+
imperative is fine; don't force bullets for a one-item list.
|
|
100
|
+
- Length budget: simple rules under ~500 characters; complex multi-step
|
|
101
|
+
rules up to ~2000. Never drop a distinct input bullet to hit a budget —
|
|
102
|
+
split into multiple playbooks under different triggers instead.
|
|
103
|
+
|
|
104
|
+
Examples:
|
|
105
|
+
|
|
106
|
+
- ❌ `"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.
|
|
107
|
+
- ✅
|
|
108
|
+
```
|
|
109
|
+
- Flag missing test coverage and any new public API without a docstring.
|
|
110
|
+
- Prioritize type-safety and correctness over style nits (line length, whitespace).
|
|
111
|
+
- For every suggested change, explain WHY it is better — not just what to change.
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
When inputs are historical prose entries, **re-shape them into bullets** in
|
|
115
|
+
the output. The aggregation step is the right place to do the upgrade.
|
|
116
|
+
|
|
117
|
+
### `rationale` — one sentence explaining WHY
|
|
118
|
+
|
|
119
|
+
- **One sentence**, synthesized across all inputs' rationales.
|
|
120
|
+
- Explains the motivation behind the rule, not the rule itself.
|
|
121
|
+
- OMIT rather than restate the content in prose.
|
|
122
|
+
|
|
123
|
+
Example:
|
|
124
|
+
|
|
125
|
+
- ✅ `"The user wants to learn the reasoning, not just apply edits."`
|
|
126
|
+
- ❌ `"For every suggested change, explain why it is better."` — that's
|
|
127
|
+
the content, not the rationale.
|
|
128
|
+
|
|
129
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
130
|
+
## Policy Consolidation Rules
|
|
131
|
+
|
|
132
|
+
To create a valid new policy, you must:
|
|
133
|
+
|
|
134
|
+
1. Synthesize all Content descriptions and Rationale summaries into ONE
|
|
135
|
+
clear `content` following the format above — actionable bullets preferred.
|
|
136
|
+
2. Analyze all Trigger conditions and synthesize ONE clear, generalized
|
|
137
|
+
`trigger` that:
|
|
138
|
+
- Captures the common theme across all listed triggers
|
|
139
|
+
- Uses imperative conditional phrasing with broad keyword coverage
|
|
140
|
+
- Is specific enough to be actionable
|
|
141
|
+
- Is general enough to cover all the variations
|
|
142
|
+
3. When input items have Rationale fields, synthesize them into a one-
|
|
143
|
+
sentence consolidated `rationale`; omit if not substantive.
|
|
144
|
+
4. Remove redundant or overlapping actions.
|
|
145
|
+
5. Normalize into a minimal enforceable policy.
|
|
146
|
+
|
|
147
|
+
Note: The Trigger conditions may vary slightly because clustering is based
|
|
148
|
+
on semantic similarity. Your job is to identify the underlying common
|
|
149
|
+
context and express it clearly.
|
|
150
|
+
|
|
151
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
152
|
+
## What a Valid Canonical Policy Must Be
|
|
153
|
+
|
|
154
|
+
It MUST:
|
|
155
|
+
- Improve agent behavior globally
|
|
156
|
+
- Be portable across topics and users
|
|
157
|
+
- Be enforceable as default behavior
|
|
158
|
+
- Eliminate the underlying failure class
|
|
159
|
+
- Not duplicate or partially overlap approved playbooks
|
|
160
|
+
|
|
161
|
+
It MUST NOT:
|
|
162
|
+
- Be a paraphrase of a raw rule
|
|
163
|
+
- Encode personal preferences
|
|
164
|
+
- Encode topic-specific behavior
|
|
165
|
+
- Add conversational language
|
|
166
|
+
|
|
167
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
168
|
+
## Output Format (Strict JSON)
|
|
169
|
+
|
|
170
|
+
Return a JSON object with the following structure:
|
|
171
|
+
|
|
172
|
+
{{
|
|
173
|
+
"playbook": {{
|
|
174
|
+
"rationale": "1 sentence: why the new policy prevents recurrence (optional)",
|
|
175
|
+
"trigger": "consolidated imperative conditional trigger (required)",
|
|
176
|
+
"content": "markdown bullet list (or single imperative sentence when only one action) — the actionable policy (required)"
|
|
177
|
+
}}
|
|
178
|
+
}}
|
|
179
|
+
|
|
180
|
+
Rules:
|
|
181
|
+
- "rationale" is OPTIONAL — one sentence on the violated expectation and why the policy prevents recurrence
|
|
182
|
+
- "trigger" is REQUIRED — must consolidate all input Trigger conditions into one imperative conditional phrase
|
|
183
|
+
- "content" is REQUIRED — bullet-shaped when multiple actions; single imperative sentence when one
|
|
184
|
+
|
|
185
|
+
If NO playbook should be generated (duplicates existing approved playbooks), return:
|
|
186
|
+
{{"playbook": null}}
|
|
187
|
+
|
|
188
|
+
Examples:
|
|
189
|
+
|
|
190
|
+
{{"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."}}}}
|
|
191
|
+
|
|
192
|
+
{{"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."}}}}
|
|
193
|
+
|
|
194
|
+
{{"playbook": null}}
|
|
195
|
+
|
|
196
|
+
{{"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."}}}}
|
|
197
|
+
|
|
198
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
199
|
+
## Existing Approved Playbooks
|
|
200
|
+
{existing_approved_playbooks}
|
|
201
|
+
|
|
202
|
+
## Clustered Raw Playbooks
|
|
203
|
+
{user_playbooks}
|
|
204
|
+
|
|
205
|
+
## Output
|
|
206
|
+
Return only the JSON object as specified above.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
active: false
|
|
3
|
+
description: "Identifies and merges duplicate playbook entries from multiple extractors (deprecated)"
|
|
4
|
+
changelog: "Add Last Modified timestamp + temporal contradiction guidance — when a NEW playbook contradicts an EXISTING one (e.g., overrides or reverses an earlier rule), prefer the newer one and group them as duplicates so the older rule is superseded. Deprecated under playbook_deduplication; renamed to playbook_consolidation. Retained as v1.0.0-deprecated to avoid filename collision with the fresh v1.0.0 introduced in Task E5."
|
|
5
|
+
variables:
|
|
6
|
+
- new_playbook_count
|
|
7
|
+
- existing_playbook_count
|
|
8
|
+
- new_playbooks
|
|
9
|
+
- existing_playbooks
|
|
10
|
+
---
|
|
11
|
+
[Goal]
|
|
12
|
+
You are a playbook deduplication assistant. Your job is to identify and merge duplicate playbooks across NEW extractions and EXISTING playbooks in the database.
|
|
13
|
+
|
|
14
|
+
[Input]
|
|
15
|
+
You will receive two groups of playbooks:
|
|
16
|
+
- {new_playbook_count} NEW playbooks (just extracted, not yet saved)
|
|
17
|
+
- {existing_playbook_count} EXISTING playbooks (already in the database)
|
|
18
|
+
|
|
19
|
+
Every playbook has a `content` field (primary human-readable content), a `trigger` field (search key), and a `Last Modified` date showing when it was extracted. Some also have optional structured fields (`instruction`, `pitfall`, `rationale`).
|
|
20
|
+
|
|
21
|
+
[NEW Playbooks]
|
|
22
|
+
{new_playbooks}
|
|
23
|
+
|
|
24
|
+
[EXISTING Playbooks]
|
|
25
|
+
{existing_playbooks}
|
|
26
|
+
|
|
27
|
+
[Your Task]
|
|
28
|
+
1. Analyze ALL playbooks (both NEW and EXISTING) and identify groups of duplicates
|
|
29
|
+
2. A duplicate group can contain ANY mix of NEW and EXISTING items — when a NEW playbook is about the same issue as an EXISTING one, they should be grouped together
|
|
30
|
+
3. For each duplicate group:
|
|
31
|
+
- List the item_ids (e.g., "NEW-0", "EXISTING-1") of all items in this group
|
|
32
|
+
- Create a merged_content that combines the best/most specific information from all members
|
|
33
|
+
- The merged result MUST always produce a `content` field and a `trigger` field. Optional fields (`instruction`, `pitfall`, `rationale`, `blocking_issue`) should be included when the group members provide them.
|
|
34
|
+
- Explain your reasoning briefly
|
|
35
|
+
4. List unique_ids of NEW playbooks that are truly unique (no duplicates found in either NEW or EXISTING)
|
|
36
|
+
|
|
37
|
+
[Guidelines for Identifying Duplicates]
|
|
38
|
+
- Playbooks about the SAME issue/insight/recommendation are duplicates even if worded differently
|
|
39
|
+
- Example: "Agent should remember user preferences" and "Agent needs to track user settings" are duplicates
|
|
40
|
+
- Example: "Response time is slow" and "Agent takes too long to respond" are duplicates
|
|
41
|
+
- Playbooks about DIFFERENT issues are NOT duplicates even if similar in structure
|
|
42
|
+
- A NEW playbook that refines or updates an EXISTING playbook should be grouped with it
|
|
43
|
+
- A NEW playbook that **contradicts or overrides** an EXISTING playbook on the same trigger MUST be grouped with the EXISTING one — for example, if EXISTING says "always do X for trigger T" and NEW says "only do X for trigger T when condition Y holds, otherwise do Z", these are duplicates and the older rule must be superseded by the newer one. Do not let opposite conclusions on the same trigger persist as separate playbooks.
|
|
44
|
+
|
|
45
|
+
[Guidelines for Merging]
|
|
46
|
+
- Combine all unique information from duplicates
|
|
47
|
+
- Remove redundancy but keep all actionable insights
|
|
48
|
+
- Use clear, concise language
|
|
49
|
+
- Choose the most specific/detailed wording when there's overlap
|
|
50
|
+
- The merged result should be the best version combining insights from all group members
|
|
51
|
+
- The merged `content` must be a clear, self-contained human-readable summary
|
|
52
|
+
- Each playbook includes a `Last Modified` date. **When a NEW playbook contradicts or overrides an EXISTING one** (e.g., reverses the rule, adds an exception that flips the default, or corrects a previous mistake), the merged playbook MUST reflect the newer guidance — use the NEW playbook's instruction/pitfall as the primary basis and only retain non-contradictory context from the older one.
|
|
53
|
+
|
|
54
|
+
[Output Format]
|
|
55
|
+
Return a JSON object with:
|
|
56
|
+
- duplicate_groups: Array of objects, each containing:
|
|
57
|
+
- item_ids: Array of strings (IDs matching the [PREFIX-N] format, e.g., "NEW-0", "EXISTING-2")
|
|
58
|
+
- merged_content: Object with fields: rationale (string or null, optional), trigger (string, required), instruction (string or null, optional), pitfall (string or null, optional), blocking_issue (object with kind and details, or null, optional), content (string, required)
|
|
59
|
+
- reasoning: String (brief explanation)
|
|
60
|
+
- unique_ids: Array of strings (IDs of unique NEW playbooks, e.g., "NEW-2")
|
|
61
|
+
|
|
62
|
+
[Important]
|
|
63
|
+
- Every NEW playbook must appear EXACTLY ONCE (either in a duplicate_group's item_ids or in unique_ids)
|
|
64
|
+
- EXISTING playbooks only appear in item_ids when they are superseded by a merged version
|
|
65
|
+
- Be conservative - only group true duplicates
|
|
66
|
+
- If there are no EXISTING playbooks, just deduplicate among the NEW playbooks
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Reconcile newly-extracted playbooks against existing storage. Decides per-candidate whether each one is a duplicate, supersedes / is superseded by an existing row, should differentiate (refine both triggers), or is independent."
|
|
3
|
+
changelog: "v1.0.0: rewritten from playbook_deduplication. Output is a 5-kind discriminated union (duplicate, prefer_new, prefer_existing, differentiate, independent). Polarity-aware: same-trigger opposite-polarity pairs must resolve to prefer_new / prefer_existing / differentiate — never duplicate or independent."
|
|
4
|
+
variables:
|
|
5
|
+
- new_playbook_count
|
|
6
|
+
- new_playbooks
|
|
7
|
+
- existing_playbooks
|
|
8
|
+
---
|
|
9
|
+
You are reconciling a set of newly-extracted playbooks (each with a `polarity` of `"positive"` or `"negative"`) against the related existing playbook rows already in storage. For each new candidate, decide its relationship to the existing rows.
|
|
10
|
+
|
|
11
|
+
[New playbooks (count: {new_playbook_count})]
|
|
12
|
+
{new_playbooks}
|
|
13
|
+
|
|
14
|
+
[Existing related playbooks]
|
|
15
|
+
{existing_playbooks}
|
|
16
|
+
|
|
17
|
+
# Decision kinds
|
|
18
|
+
|
|
19
|
+
Emit exactly one decision per `(new, related-existing)` consideration. Each decision is one of:
|
|
20
|
+
|
|
21
|
+
- **duplicate** — same intent across NEW + one-or-more EXISTING (same trigger, same polarity, semantically the same rule). Set `kind: "duplicate"`, list all `item_ids`, write `merged_content` / `merged_trigger` / `merged_rationale`, and set `merged_polarity` to the polarity all members share. All members MUST share polarity.
|
|
22
|
+
|
|
23
|
+
- **prefer_new** — NEW wins; archive the existing row and insert NEW. Choose when:
|
|
24
|
+
- NEW contradicts EXISTING (opposite polarity) and NEW's evidence is stronger, OR
|
|
25
|
+
- NEW is broader and correctly subsumes EXISTING's narrower case.
|
|
26
|
+
|
|
27
|
+
- **prefer_existing** — EXISTING wins; drop NEW. Choose when:
|
|
28
|
+
- EXISTING contradicts NEW (opposite polarity) and EXISTING's evidence is stronger, OR
|
|
29
|
+
- EXISTING is broader and already subsumes NEW's narrower case, OR
|
|
30
|
+
- NEW is a weaker / stale restatement of EXISTING.
|
|
31
|
+
|
|
32
|
+
- **differentiate** — both valid in distinct contexts (typically same trigger, opposite polarity, where the contexts differ). Set `refined_new_trigger` and `refined_existing_trigger` to be strictly narrower than the originals AND mutually exclusive.
|
|
33
|
+
|
|
34
|
+
- **independent** — different topic or trigger from any existing row. Insert NEW with no archive.
|
|
35
|
+
|
|
36
|
+
# Hard constraints
|
|
37
|
+
|
|
38
|
+
- A pair with the same trigger and opposite polarity MUST resolve to `prefer_new`, `prefer_existing`, or `differentiate`. NEVER `duplicate` (different intent). NEVER `independent` (same trigger).
|
|
39
|
+
- Polarity comes from each playbook's `polarity` field — do not infer it from content framing.
|
|
40
|
+
- `differentiate.refined_new_trigger` and `refined_existing_trigger` MUST be non-empty and strictly narrower than the originals.
|
|
41
|
+
- When in doubt about a same-trigger opposite-polarity stalemate, default to `prefer_existing`. Storage stability wins ties.
|
|
42
|
+
|
|
43
|
+
Output strictly conforming to the `PlaybookConsolidationOutput` schema (a JSON object with a single key `decisions` whose entries each carry a `kind` discriminator).
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
active: false
|
|
3
|
+
description: "Reconcile newly-extracted playbooks against existing storage. Decides per-candidate whether each one is a duplicate, supersedes / is superseded by an existing row, should differentiate (refine both triggers), or is independent."
|
|
4
|
+
changelog: "v1.1.0: rendered NEW/EXISTING rows now include `Trigger` and `Rationale` alongside `Content` so the model can compare the fields it is asked to refine (differentiate, same-trigger contradictions, trigger refinements). No variable changes."
|
|
5
|
+
variables:
|
|
6
|
+
- new_playbook_count
|
|
7
|
+
- new_playbooks
|
|
8
|
+
- existing_playbooks
|
|
9
|
+
---
|
|
10
|
+
You are reconciling a set of newly-extracted playbooks (each with a `polarity` of `"positive"` or `"negative"`) 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`, `Polarity`, `Name`, `Source`, and `Last Modified`. Use `Trigger` and `Polarity` (not content framing) as the primary keys for comparison.
|
|
13
|
+
|
|
14
|
+
[New playbooks (count: {new_playbook_count})]
|
|
15
|
+
{new_playbooks}
|
|
16
|
+
|
|
17
|
+
[Existing related playbooks]
|
|
18
|
+
{existing_playbooks}
|
|
19
|
+
|
|
20
|
+
# Decision kinds
|
|
21
|
+
|
|
22
|
+
Emit exactly one decision per `(new, related-existing)` consideration. Each decision is one of:
|
|
23
|
+
|
|
24
|
+
- **duplicate** — same intent across NEW + one-or-more EXISTING (same trigger, same polarity, semantically the same rule). Set `kind: "duplicate"`, list all `item_ids`, write `merged_content` / `merged_trigger` / `merged_rationale`, and set `merged_polarity` to the polarity all members share. All members MUST share polarity.
|
|
25
|
+
|
|
26
|
+
- **prefer_new** — NEW wins; archive the existing row and insert NEW. Choose when:
|
|
27
|
+
- NEW contradicts EXISTING (opposite polarity) and NEW's evidence is stronger, OR
|
|
28
|
+
- NEW is broader and correctly subsumes EXISTING's narrower case.
|
|
29
|
+
|
|
30
|
+
- **prefer_existing** — EXISTING wins; drop NEW. Choose when:
|
|
31
|
+
- EXISTING contradicts NEW (opposite polarity) and EXISTING's evidence is stronger, OR
|
|
32
|
+
- EXISTING is broader and already subsumes NEW's narrower case, OR
|
|
33
|
+
- NEW is a weaker / stale restatement of EXISTING.
|
|
34
|
+
|
|
35
|
+
- **differentiate** — both valid in distinct contexts (typically same trigger, opposite polarity, where the contexts differ). Set `refined_new_trigger` and `refined_existing_trigger` to be strictly narrower than the originals AND mutually exclusive.
|
|
36
|
+
|
|
37
|
+
- **independent** — different topic or trigger from any existing row. Insert NEW with no archive.
|
|
38
|
+
|
|
39
|
+
# Hard constraints
|
|
40
|
+
|
|
41
|
+
- A pair with the same trigger and opposite polarity MUST resolve to `prefer_new`, `prefer_existing`, or `differentiate`. NEVER `duplicate` (different intent). NEVER `independent` (same trigger).
|
|
42
|
+
- Polarity comes from each playbook's `polarity` field — do not infer it from content framing.
|
|
43
|
+
- `differentiate.refined_new_trigger` and `refined_existing_trigger` MUST be non-empty and strictly narrower than the originals.
|
|
44
|
+
- When in doubt about a same-trigger opposite-polarity stalemate, default to `prefer_existing`. Storage stability wins ties.
|
|
45
|
+
|
|
46
|
+
Output strictly conforming to the `PlaybookConsolidationOutput` schema (a JSON object with a single key `decisions` whose entries each carry a `kind` discriminator).
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
active: false
|
|
3
|
+
description: "Identifies and merges duplicate playbook entries from multiple extractors — simplified schema without instruction/pitfall (deprecated; superseded by v1.0.0 in Task E5)"
|
|
4
|
+
changelog: "v2: Remove instruction and pitfall fields. Content is the sole actionable field. Simplified merged output format. Drop unused per-group reasoning field to reduce output token usage. Renamed from playbook_deduplication to playbook_consolidation in Task E1. Marked -deprecated to avoid filename collision with the fresh v1.0.0 that Task E5 introduced; flipped active: false once the fresh v1.0.0 landed."
|
|
5
|
+
variables:
|
|
6
|
+
- new_playbook_count
|
|
7
|
+
- existing_playbook_count
|
|
8
|
+
- new_playbooks
|
|
9
|
+
- existing_playbooks
|
|
10
|
+
---
|
|
11
|
+
[Goal]
|
|
12
|
+
You are a playbook deduplication assistant. Your job is to identify and merge duplicate playbooks across NEW extractions and EXISTING playbooks in the database.
|
|
13
|
+
|
|
14
|
+
[Input]
|
|
15
|
+
You will receive two groups of playbooks:
|
|
16
|
+
- {new_playbook_count} NEW playbooks (just extracted, not yet saved)
|
|
17
|
+
- {existing_playbook_count} EXISTING playbooks (already in the database)
|
|
18
|
+
|
|
19
|
+
Every playbook has a `content` field (primary human-readable content), a `trigger` field (search key), and a `Last Modified` date showing when it was extracted. Some also have optional fields (`rationale`).
|
|
20
|
+
|
|
21
|
+
[NEW Playbooks]
|
|
22
|
+
{new_playbooks}
|
|
23
|
+
|
|
24
|
+
[EXISTING Playbooks]
|
|
25
|
+
{existing_playbooks}
|
|
26
|
+
|
|
27
|
+
[Your Task]
|
|
28
|
+
1. Analyze ALL playbooks (both NEW and EXISTING) and identify groups of duplicates
|
|
29
|
+
2. A duplicate group can contain ANY mix of NEW and EXISTING items — when a NEW playbook is about the same issue as an EXISTING one, they should be grouped together
|
|
30
|
+
3. For each duplicate group:
|
|
31
|
+
- List the item_ids (e.g., "NEW-0", "EXISTING-1") of all items in this group
|
|
32
|
+
- Create a merged_content that combines the best/most specific information from all members
|
|
33
|
+
- The merged result MUST always produce a `content` field and a `trigger` field. Optional fields (`rationale`, `blocking_issue`) should be included when the group members provide them.
|
|
34
|
+
4. List unique_ids of NEW playbooks that are truly unique (no duplicates found in either NEW or EXISTING)
|
|
35
|
+
|
|
36
|
+
[Guidelines for Identifying Duplicates]
|
|
37
|
+
- Playbooks about the SAME issue/insight/recommendation are duplicates even if worded differently
|
|
38
|
+
- Example: "Agent should remember user preferences" and "Agent needs to track user settings" are duplicates
|
|
39
|
+
- Example: "Response time is slow" and "Agent takes too long to respond" are duplicates
|
|
40
|
+
- Playbooks about DIFFERENT issues are NOT duplicates even if similar in structure
|
|
41
|
+
- A NEW playbook that refines or updates an EXISTING playbook should be grouped with it
|
|
42
|
+
- A NEW playbook that **contradicts or overrides** an EXISTING playbook on the same trigger MUST be grouped with the EXISTING one — for example, if EXISTING says "always do X for trigger T" and NEW says "only do X for trigger T when condition Y holds, otherwise do Z", these are duplicates and the older rule must be superseded by the newer one. Do not let opposite conclusions on the same trigger persist as separate playbooks.
|
|
43
|
+
|
|
44
|
+
[Guidelines for Merging]
|
|
45
|
+
- Combine all unique information from duplicates
|
|
46
|
+
- Remove redundancy but keep all actionable insights
|
|
47
|
+
- Use clear, concise language
|
|
48
|
+
- Choose the most specific/detailed wording when there's overlap
|
|
49
|
+
- The merged result should be the best version combining insights from all group members
|
|
50
|
+
- The merged `content` must be a clear, self-contained human-readable summary
|
|
51
|
+
- Each playbook includes a `Last Modified` date. **When a NEW playbook contradicts or overrides an EXISTING one** (e.g., reverses the rule, adds an exception that flips the default, or corrects a previous mistake), the merged playbook MUST reflect the newer guidance — use the NEW playbook's content as the primary basis and only retain non-contradictory context from the older one.
|
|
52
|
+
|
|
53
|
+
[Output Format]
|
|
54
|
+
Return a JSON object with:
|
|
55
|
+
- duplicate_groups: Array of objects, each containing:
|
|
56
|
+
- item_ids: Array of strings (IDs matching the [PREFIX-N] format, e.g., "NEW-0", "EXISTING-2")
|
|
57
|
+
- merged_content: Object with fields: rationale (string or null, optional), trigger (string, required), blocking_issue (object with kind and details, or null, optional), content (string, required)
|
|
58
|
+
- unique_ids: Array of strings (IDs of unique NEW playbooks, e.g., "NEW-2")
|
|
59
|
+
|
|
60
|
+
[Important]
|
|
61
|
+
- Every NEW playbook must appear EXACTLY ONCE (either in a duplicate_group's item_ids or in unique_ids)
|
|
62
|
+
- EXISTING playbooks only appear in item_ids when they are superseded by a merged version
|
|
63
|
+
- Be conservative - only group true duplicates
|
|
64
|
+
- If there are no EXISTING playbooks, just deduplicate among the NEW playbooks
|