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,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
active: false
|
|
3
|
+
description: "Reconcile newly-extracted playbooks against existing storage. Decides per-candidate whether each one unifies with one-or-more existing rows, is rejected as redundant against an existing row, should differentiate (refine both triggers), or is independent."
|
|
4
|
+
changelog: "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 (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 candidate. Each decision is one of:
|
|
23
|
+
|
|
24
|
+
- **unify** — the NEW is the same rule as one or more EXISTING rows (after merge), OR the NEW supersedes one EXISTING (stronger / broader / more specific evidence). Provide the final `content`, `trigger`, `rationale`, and `polarity`. List which EXISTING ids you're archiving in `archive_existing_ids` (use an empty list when no EXISTING rows are absorbed). Every archived EXISTING must share the chosen `polarity` — the polarity validator will reject mixed-polarity unify.
|
|
25
|
+
|
|
26
|
+
- **reject_new** — an EXISTING row already covers NEW or makes NEW redundant. Name the EXISTING id that wins via `superseded_by_existing_id`. Storage-stability tie-break: when same-trigger opposite-polarity evidence is balanced, default here.
|
|
27
|
+
|
|
28
|
+
- **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.
|
|
29
|
+
|
|
30
|
+
- **independent** — different topic or trigger from any existing row. Insert NEW with no archive.
|
|
31
|
+
|
|
32
|
+
# Hard constraints
|
|
33
|
+
|
|
34
|
+
- A NEW + EXISTING pair with the same trigger and opposite polarity MUST route to `unify` (only if you can pick one shared polarity backed by evidence — the polarity validator will reject mixed-polarity unify), `reject_new`, or `differentiate`. Never `independent`.
|
|
35
|
+
- Polarity comes from each playbook's `polarity` field — do not infer it from content framing.
|
|
36
|
+
- `differentiate.refined_new_trigger` and `refined_existing_trigger` MUST be non-empty and strictly narrower than the originals.
|
|
37
|
+
- When in doubt about a same-trigger opposite-polarity stalemate, default to `reject_new`. Storage stability wins ties.
|
|
38
|
+
|
|
39
|
+
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,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
active: false
|
|
3
|
+
description: "Reconcile newly-extracted playbooks against existing storage. Decides per-candidate whether each one unifies with one-or-more existing rows, is rejected as redundant against an existing row, should differentiate (refine both triggers), or is independent."
|
|
4
|
+
changelog: "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`, `Polarity`, `Name`, `Source`, and `Last Modified`. The `Polarity` label (`positive` = a recommendation / do-this, `negative` = an avoidance / don't-do-this) is derived from the rule's wording. Use `Trigger` and `Polarity` 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 candidate. Each decision is one of:
|
|
23
|
+
|
|
24
|
+
- **unify** — the NEW is the same rule as one or more EXISTING rows (after merge), OR the NEW supersedes one EXISTING (stronger / broader / more specific evidence). 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). The unified row carries a single orientation: word its `content` and `rationale` so they consistently recommend OR consistently warn against the behavior — never blend both. Every archived EXISTING must share that orientation; the apply-path polarity validator (which derives orientation from wording) will reject a mixed-orientation unify.
|
|
25
|
+
|
|
26
|
+
- **reject_new** — an EXISTING row already covers NEW or makes NEW redundant. Name the EXISTING id that wins via `superseded_by_existing_id`. Storage-stability tie-break: when same-trigger opposite-orientation evidence is balanced, default here.
|
|
27
|
+
|
|
28
|
+
- **differentiate** — both valid in distinct contexts (typically same trigger, opposite orientation, where the contexts differ). Set `refined_new_trigger` and `refined_existing_trigger` to be strictly narrower than the originals AND mutually exclusive.
|
|
29
|
+
|
|
30
|
+
- **independent** — different topic or trigger from any existing row. Insert NEW with no archive.
|
|
31
|
+
|
|
32
|
+
# Hard constraints
|
|
33
|
+
|
|
34
|
+
- A NEW + EXISTING pair with the same trigger and opposite orientation MUST route to `unify` (only if you can pick one shared orientation backed by evidence and word the unified row accordingly — the polarity validator will reject a mixed-orientation unify), `reject_new`, or `differentiate`. Never `independent`.
|
|
35
|
+
- Orientation is read from each row's wording (the derived `Polarity` label). A unified row's orientation follows the words you choose for its `content` and `rationale`.
|
|
36
|
+
- `differentiate.refined_new_trigger` and `refined_existing_trigger` MUST be non-empty and strictly narrower than the originals.
|
|
37
|
+
- When in doubt about a same-trigger opposite-orientation stalemate, default to `reject_new`. Storage stability wins ties.
|
|
38
|
+
|
|
39
|
+
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,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
active: false
|
|
3
|
+
description: "Reconcile newly-extracted playbooks against existing storage. Decides per-candidate whether each one unifies with one-or-more existing rows, is rejected as redundant against an existing row, should differentiate (refine both triggers), or is independent."
|
|
4
|
+
changelog: "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`, `Polarity`, `Name`, `Source`, and `Last Modified`. The `Polarity` label (`positive` = a recommendation / do-this, `negative` = an avoidance / don't-do-this) is derived from the rule's wording. Use `Trigger` and `Polarity` 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 candidate. Each decision is one of:
|
|
23
|
+
|
|
24
|
+
- **unify** — the NEW is the same rule as one or more EXISTING rows (after merge), OR the NEW supersedes one EXISTING (stronger / broader / more specific evidence). 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). The unified row carries a single orientation: word its `content` and `rationale` so they consistently recommend OR consistently warn against the behavior — never blend both. Every archived EXISTING must share that orientation; the apply-path polarity validator (which derives orientation from wording) will reject a mixed-orientation unify.
|
|
25
|
+
|
|
26
|
+
- **reject_new** — an EXISTING row already covers NEW or makes NEW redundant. Name the EXISTING id that wins via `superseded_by_existing_id`. Storage-stability tie-break: when same-trigger opposite-orientation evidence is balanced, default here.
|
|
27
|
+
|
|
28
|
+
- **differentiate** — both valid in distinct contexts (typically same trigger, opposite orientation, where the contexts differ). Set `refined_new_trigger` and `refined_existing_trigger` to be strictly narrower than the originals AND mutually exclusive.
|
|
29
|
+
|
|
30
|
+
- **independent** — different topic or trigger from any existing row. Insert NEW with no archive.
|
|
31
|
+
|
|
32
|
+
# How to write a unified row (re-synthesis, not concatenation)
|
|
33
|
+
|
|
34
|
+
When you `unify`, re-synthesize a single leaner rule. Do not stitch the inputs together.
|
|
35
|
+
|
|
36
|
+
- 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.
|
|
37
|
+
- **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.
|
|
38
|
+
- Prefer **`differentiate` over `unify`** when merging the inputs would force an over-long, low-cohesion rule. Two focused rules that each read cleanly beat one bloated rule that tries to say everything. If you cannot state the merged rule concisely without losing distinct failure detail, that is a signal to `differentiate` (or keep NEW `independent`) rather than `unify`.
|
|
39
|
+
|
|
40
|
+
# Hard constraints
|
|
41
|
+
|
|
42
|
+
- A NEW + EXISTING pair with the same trigger and opposite orientation MUST route to `unify` (only if you can pick one shared orientation backed by evidence and word the unified row accordingly — the polarity validator will reject a mixed-orientation unify), `reject_new`, or `differentiate`. Never `independent`.
|
|
43
|
+
- Orientation is read from each row's wording (the derived `Polarity` label). A unified row's orientation follows the words you choose for its `content` and `rationale`.
|
|
44
|
+
- `differentiate.refined_new_trigger` and `refined_existing_trigger` MUST be non-empty and strictly narrower than the originals.
|
|
45
|
+
- When in doubt about a same-trigger opposite-orientation stalemate, default to `reject_new`. Storage stability wins ties.
|
|
46
|
+
|
|
47
|
+
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,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
active: false
|
|
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.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
|
+
[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 candidate. Each decision is one of:
|
|
23
|
+
|
|
24
|
+
- **unify** — the NEW belongs in the same skill as one or more EXISTING rows. This covers two cases:
|
|
25
|
+
1. **Dedup / supersede** — the NEW is the same rule as an EXISTING row (after merge), or supersedes one (stronger / broader / more specific evidence).
|
|
26
|
+
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`.
|
|
27
|
+
|
|
28
|
+
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`.
|
|
29
|
+
|
|
30
|
+
- **reject_new** — an EXISTING row already covers NEW or makes NEW redundant. Name the EXISTING id that wins via `superseded_by_existing_id`. Storage-stability tie-break: when same-situation opposite advice is balanced, default here.
|
|
31
|
+
|
|
32
|
+
- **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.
|
|
33
|
+
|
|
34
|
+
- **independent** — different topic or task from any existing row. Insert NEW with no archive.
|
|
35
|
+
|
|
36
|
+
# How to write a unified skill (re-synthesis, not concatenation)
|
|
37
|
+
|
|
38
|
+
When you `unify`, re-synthesize a single leaner skill. Do not stitch the inputs together.
|
|
39
|
+
|
|
40
|
+
- 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.
|
|
41
|
+
- 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.
|
|
42
|
+
- **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.
|
|
43
|
+
- 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`.
|
|
44
|
+
|
|
45
|
+
# The no-self-contradiction guard
|
|
46
|
+
|
|
47
|
+
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).
|
|
48
|
+
|
|
49
|
+
- 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).
|
|
50
|
+
- Mixed polarity across **different** sub-aspects is fine and expected; mixed advice on the **same** sub-aspect is the forbidden case.
|
|
51
|
+
|
|
52
|
+
# Hard constraints
|
|
53
|
+
|
|
54
|
+
- 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`.
|
|
55
|
+
- `differentiate.refined_new_trigger` and `refined_existing_trigger` MUST be non-empty and strictly narrower than the originals.
|
|
56
|
+
- When in doubt about a same-situation opposite-advice stalemate, default to `reject_new`. Storage stability wins ties.
|
|
57
|
+
|
|
58
|
+
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,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
active: false
|
|
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.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
|
+
[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 candidate. Each decision is one of:
|
|
23
|
+
|
|
24
|
+
- **unify** — the NEW belongs in the same skill as one or more EXISTING rows. This covers two cases:
|
|
25
|
+
1. **Dedup / supersede** — the NEW is the same rule as an EXISTING row (after merge), or supersedes one (stronger / broader / more specific evidence).
|
|
26
|
+
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`.
|
|
27
|
+
|
|
28
|
+
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`.
|
|
29
|
+
|
|
30
|
+
- **reject_new** — an EXISTING row already covers NEW or makes NEW redundant. Name the EXISTING id that wins via `superseded_by_existing_id`. Storage-stability tie-break: when same-situation opposite advice is balanced, default here.
|
|
31
|
+
|
|
32
|
+
- **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.
|
|
33
|
+
|
|
34
|
+
- **independent** — different topic or task from any existing row. Insert NEW with no archive.
|
|
35
|
+
|
|
36
|
+
# How to write a unified skill (re-synthesis, not concatenation)
|
|
37
|
+
|
|
38
|
+
When you `unify`, re-synthesize a single leaner skill. Do not stitch the inputs together.
|
|
39
|
+
|
|
40
|
+
- 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.
|
|
41
|
+
- 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.
|
|
42
|
+
- **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.
|
|
43
|
+
- 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`.
|
|
44
|
+
|
|
45
|
+
# The no-self-contradiction guard
|
|
46
|
+
|
|
47
|
+
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).
|
|
48
|
+
|
|
49
|
+
- 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).
|
|
50
|
+
- Mixed polarity across **different** sub-aspects is fine and expected; mixed advice on the **same** sub-aspect is the forbidden case.
|
|
51
|
+
|
|
52
|
+
# Hard constraints
|
|
53
|
+
|
|
54
|
+
- 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`.
|
|
55
|
+
- `differentiate.refined_new_trigger` and `refined_existing_trigger` MUST be non-empty and strictly narrower than the originals.
|
|
56
|
+
- When in doubt about a same-situation opposite-advice stalemate, default to `reject_new`. Storage stability wins ties.
|
|
57
|
+
|
|
58
|
+
# Output Format Guidance
|
|
59
|
+
|
|
60
|
+
Respond ONLY with a valid JSON object matching `PlaybookConsolidationOutput`: `{{"decisions": [<one decision object for each NEW candidate>]}}`.
|
|
61
|
+
|
|
62
|
+
Each decision object MUST include `kind` and `new_id`. The `kind` value determines the remaining required fields:
|
|
63
|
+
|
|
64
|
+
- `unify`: include `archive_existing_ids` as a list of EXISTING list positions, plus final `content`, `trigger`, and `rationale`; optional `reason` may explain the decision.
|
|
65
|
+
- `reject_new`: include `superseded_by_existing_id` as the existing row's database id; optional `reason` may explain the decision.
|
|
66
|
+
- `differentiate`: include `existing_id` as the existing row's database id, plus non-empty `refined_new_trigger` and `refined_existing_trigger`; optional `reason` may explain the decision.
|
|
67
|
+
- `independent`: include only `kind`, `new_id`, and optional `reason`.
|
|
68
|
+
|
|
69
|
+
Do not emit markdown, prose, comments, chain-of-thought, or top-level keys other than `decisions`. Do not include fields from another decision kind.
|
|
@@ -0,0 +1,71 @@
|
|
|
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.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
|
+
[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 candidate. Each decision is one of:
|
|
23
|
+
|
|
24
|
+
- **unify** — the NEW belongs in the same skill as one or more EXISTING rows. This covers two cases:
|
|
25
|
+
1. **Dedup / supersede** — the NEW is the same rule as an EXISTING row (after merge), or supersedes one (stronger / broader / more specific evidence).
|
|
26
|
+
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`.
|
|
27
|
+
|
|
28
|
+
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`.
|
|
29
|
+
|
|
30
|
+
- **reject_new** — an EXISTING row already covers NEW or makes NEW redundant. Name the EXISTING id that wins via `superseded_by_existing_id`. Storage-stability tie-break: when same-situation opposite advice is balanced, default here.
|
|
31
|
+
|
|
32
|
+
- **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.
|
|
33
|
+
|
|
34
|
+
- **independent** — different topic or task from any existing row. Insert NEW with no archive.
|
|
35
|
+
|
|
36
|
+
# How to write a unified skill (re-synthesis, not concatenation)
|
|
37
|
+
|
|
38
|
+
When you `unify`, re-synthesize a single leaner skill. Do not stitch the inputs together.
|
|
39
|
+
|
|
40
|
+
- 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.
|
|
41
|
+
- 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.
|
|
42
|
+
- **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.
|
|
43
|
+
- 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.
|
|
44
|
+
- 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`.
|
|
45
|
+
|
|
46
|
+
# The no-self-contradiction guard
|
|
47
|
+
|
|
48
|
+
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).
|
|
49
|
+
|
|
50
|
+
- 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).
|
|
51
|
+
- Mixed polarity across **different** sub-aspects is fine and expected; mixed advice on the **same** sub-aspect is the forbidden case.
|
|
52
|
+
|
|
53
|
+
# Hard constraints
|
|
54
|
+
|
|
55
|
+
- 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`.
|
|
56
|
+
- `differentiate.refined_new_trigger` and `refined_existing_trigger` MUST be non-empty and strictly narrower than the originals.
|
|
57
|
+
- Numeric id fields MUST contain bare integers, not display labels or bracketed row prefixes. Rendered row labels are for human reading only; they are never valid values for `superseded_by_existing_id` or `existing_id`.
|
|
58
|
+
- When in doubt about a same-situation opposite-advice stalemate, default to `reject_new`. Storage stability wins ties.
|
|
59
|
+
|
|
60
|
+
# Output Format Guidance
|
|
61
|
+
|
|
62
|
+
Respond ONLY with a valid JSON object matching `PlaybookConsolidationOutput`: `{{"decisions": [<one decision object for each NEW candidate>]}}`.
|
|
63
|
+
|
|
64
|
+
Each decision object MUST include `kind` and `new_id`. `new_id` is the rendered NEW label string. All EXISTING references use the numeric fields below.
|
|
65
|
+
|
|
66
|
+
- `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.
|
|
67
|
+
- `reject_new`: include `superseded_by_existing_id` as an integer only; optional `reason` may explain the decision.
|
|
68
|
+
- `differentiate`: include `existing_id` as an integer only, plus non-empty `refined_new_trigger` and `refined_existing_trigger`; optional `reason` may explain the decision.
|
|
69
|
+
- `independent`: include only `kind`, `new_id`, and optional `reason`.
|
|
70
|
+
|
|
71
|
+
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.
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
---
|
|
2
|
+
active: false
|
|
3
|
+
description: "Context setting prompt for playbook extraction. Every claim must be both (a) grounded in the conversation and (b) generalized to apply in any repo; both requirements apply jointly to Correction SOPs and Success Path Recipes."
|
|
4
|
+
changelog: "v4.0.2: Promotes 'grounded AND generalized' to a single joint requirement covering both categories, hoisted into Content Grounding Rules. Trigger Quality and Success Path content sections now defer to that principle instead of restating it. Rule of thumb is split into the two checks both entries must pass. Example 3 generalized so it no longer pins specific filenames or column letters."
|
|
5
|
+
variables:
|
|
6
|
+
- agent_context_prompt
|
|
7
|
+
- extraction_definition_prompt
|
|
8
|
+
- tool_can_use
|
|
9
|
+
---
|
|
10
|
+
You are a self-improvement policy mining assistant for AI agents.
|
|
11
|
+
Your job is to extract **reusable patterns** from agent trajectories that help similar future tasks run faster and more accurately.
|
|
12
|
+
|
|
13
|
+
You extract TWO CATEGORIES of patterns, and a single trajectory can contain BOTH:
|
|
14
|
+
|
|
15
|
+
1. **Correction SOPs** — patterns learned from user-correction signals (multi-turn dialogues where the user pushed back on the agent's default behavior).
|
|
16
|
+
2. **Success Path Recipes** — concrete solution paths extracted from successful task completions, so a future run of a similar task can go directly to the answer instead of re-discovering it.
|
|
17
|
+
|
|
18
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
19
|
+
## Category 1 — Correction SOPs
|
|
20
|
+
|
|
21
|
+
Extract a **Correction SOP** when ALL are true:
|
|
22
|
+
1. The agent performed an action, assumption, or default behavior.
|
|
23
|
+
2. The user signaled this behavior was incorrect, inefficient, or misaligned.
|
|
24
|
+
3. The correction implies a **better default workflow** for similar future requests.
|
|
25
|
+
|
|
26
|
+
### Valid Correction Signals
|
|
27
|
+
Look for cross-turn causal patterns, not isolated messages.
|
|
28
|
+
|
|
29
|
+
Valid signals include:
|
|
30
|
+
* User correcting or rejecting the agent's approach
|
|
31
|
+
* User redirecting the agent to a different mode or level of detail
|
|
32
|
+
* User expressing dissatisfaction with how the agent behaved
|
|
33
|
+
* User clarifying expectations that contradict the agent's behavior
|
|
34
|
+
* Agent retrying a tool call with different inputs after getting poor or irrelevant results (self-correction)
|
|
35
|
+
* Agent switching from one tool to another within the same task after inadequate results
|
|
36
|
+
|
|
37
|
+
You MUST identify the triggering agent behavior
|
|
38
|
+
(assumption made, default chosen, constraint ignored, or question not asked).
|
|
39
|
+
|
|
40
|
+
### Trigger Quality
|
|
41
|
+
|
|
42
|
+
A valid `trigger` describes the **problem or situation**, NOT the user's explicitly stated preference.
|
|
43
|
+
* **BAD:** "User requests CLI tools." (Just restates the user's explicit ask.)
|
|
44
|
+
* **GOOD:** "User reports timeout or performance failures on large data transfers (>10TB)."
|
|
45
|
+
|
|
46
|
+
Both `trigger` and `content` must satisfy the joint grounded-and-generalized requirement defined in Content Grounding Rules below.
|
|
47
|
+
|
|
48
|
+
### Tautology Check (Correction SOPs only)
|
|
49
|
+
If the `trigger` can be reduced to "user asks for X" and the `content` is "do X", the SOP is tautological. Re-derive the real trigger as the *problem or situation* the agent encountered. This check does NOT apply to Success Path Recipes.
|
|
50
|
+
|
|
51
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
52
|
+
## Category 2 — Success Path Recipes
|
|
53
|
+
|
|
54
|
+
Extract a **Success Path Recipe** when ALL are true:
|
|
55
|
+
1. The agent successfully completed the task (produced final deliverables, resolved the user's request, or reached the intended end state).
|
|
56
|
+
2. The original trajectory contained **removable inefficiency** — at least one of:
|
|
57
|
+
- A failed tool call before a successful retry
|
|
58
|
+
- Parameters that had to be tuned after returning wrong or incomplete results
|
|
59
|
+
- A tool swapped mid-task after the first choice did not work
|
|
60
|
+
- A redundant or dead-end step that did not contribute to the final answer
|
|
61
|
+
- Discovery work (reading docs, probing formats, sampling data) that a future agent, armed with what was learned, could skip
|
|
62
|
+
3. The inefficiency is removable: given what the final working approach turned out to be, a future agent could go straight there.
|
|
63
|
+
|
|
64
|
+
If the agent reached the answer on a clean first-try path with no retries, tuning, tool swaps, or detours, **do not emit a recipe** — there is nothing to optimize.
|
|
65
|
+
|
|
66
|
+
A Success Path Recipe does NOT require a user-correction signal.
|
|
67
|
+
|
|
68
|
+
### Success Path content format
|
|
69
|
+
|
|
70
|
+
The `content` field is the **optimized, replayable path** — the straight-line sequence the original trajectory converged to, with detours removed. Name the tool category, the shape of parameters, and the order of operations (the dual grounded-and-generalized requirement applies — see Content Grounding Rules).
|
|
71
|
+
|
|
72
|
+
Keep entries concise — a quick reference, not a recap. Omit restated user feedback, log excerpts, and summary preambles.
|
|
73
|
+
|
|
74
|
+
End with one short line naming the detour from the original path that the reader should skip. A generic "follow best practices" is worthless; a step-by-step sequence plus the detour to skip is gold.
|
|
75
|
+
|
|
76
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
77
|
+
## Content Grounding Rules (CRITICAL)
|
|
78
|
+
|
|
79
|
+
Every entry — both Correction SOPs and Success Path Recipes — must satisfy two joint requirements:
|
|
80
|
+
|
|
81
|
+
1. **Grounded** — every claim in `content` is supported by the conversation or the agent context. Do NOT invent policies, escalation paths, tools, teams, or procedures.
|
|
82
|
+
2. **Generalized** — the entry applies in a different repo with no access to this conversation. Restate repo-private artifacts (file paths, table names, module names, org-specific constants) in terms of their abstract role; original concretes may appear only as illustrative cues ("e.g., here it was the org-level config file").
|
|
83
|
+
|
|
84
|
+
Grounding constrains the *source* of a claim (it must come from the conversation), not its *form*. An entry that faithfully cites a specific path or variable name is grounded but not generalized — it still fails. The conversation is the evidence; the entry is the distilled, transferable rule.
|
|
85
|
+
|
|
86
|
+
**GOOD content** — grounded in evidence:
|
|
87
|
+
- Describes what the agent did wrong (traceable to a specific agent turn)
|
|
88
|
+
- Describes what the user wanted instead (traceable to a specific user turn)
|
|
89
|
+
- States what the agent should avoid doing (the observed mistake)
|
|
90
|
+
- If the agent lacks a capability, says so honestly without inventing a workaround
|
|
91
|
+
|
|
92
|
+
**BAD content** — hallucinated:
|
|
93
|
+
- Invents escalation paths ("transfer to the shipping team") when no such team was mentioned
|
|
94
|
+
- Invents specific procedures ("check the confirmation email for tracking links") when the user never mentioned these exist
|
|
95
|
+
- Prescribes solutions the agent has no evidence it can actually do
|
|
96
|
+
- Adds generic customer-service advice not grounded in this specific interaction
|
|
97
|
+
|
|
98
|
+
**When the agent doesn't know what to do:** Describe what to AVOID (the observed mistake) and state the limitation honestly. It is much better to say "do not fabricate order status — admit you cannot look it up" than to invent a specific alternative the agent may not actually have.
|
|
99
|
+
|
|
100
|
+
**Rule of thumb (both checks must pass):**
|
|
101
|
+
1. *Grounded* — if you remove the conversation and only read the `content`, could someone verify every claim by re-reading the conversation? If not, you've hallucinated.
|
|
102
|
+
2. *Generalized* — could a future agent in a different repo, with no access to this conversation, apply the entry as written? If not, you've overfit — restate the pattern at the level of tool category, parameter shape, and order of operations.
|
|
103
|
+
|
|
104
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
105
|
+
## Reasoning Procedure (REQUIRED)
|
|
106
|
+
|
|
107
|
+
For **Correction SOPs**:
|
|
108
|
+
1. Identify user turns containing correction, rejection, or redirection
|
|
109
|
+
2. Trace backwards to the exact agent behavior that triggered it
|
|
110
|
+
3. Identify the violated implicit expectation
|
|
111
|
+
4. Draft the `trigger` (the problem or situation)
|
|
112
|
+
5. Tautology Check (see above)
|
|
113
|
+
6. Draft `content`: reason through what the agent did wrong and what the user's feedback tells us the agent should do differently. Ground every statement in evidence from the conversation. If the user told the agent what to do, capture that. If the user only told the agent what NOT to do, capture the avoidance. Do not guess what the right action is if the conversation doesn't tell you.
|
|
114
|
+
|
|
115
|
+
For **Success Path Recipes**:
|
|
116
|
+
1. Identify whether the agent completed the task successfully
|
|
117
|
+
2. Scan the trajectory for **removable inefficiency**: a failed tool call followed by a retry, parameters retuned after bad output, a tool swapped mid-task, redundant or dead-end steps, or discovery work a future agent could skip. If none are present, **stop — do not emit a recipe.**
|
|
118
|
+
3. Enumerate the final working approach as a sequence of tool categories, parameter shapes, and ordered operations — translate any repo-private concretes (paths, column names, constants) into their abstract role
|
|
119
|
+
4. Frame the trigger as a reusable task-type description (domain + action)
|
|
120
|
+
5. Compose `content` as the **optimized straight-line path** — specific enough to replay without re-deriving anything, generalized enough to apply in a different repo — and add one short line naming the detour from the original trajectory that the reader should skip
|
|
121
|
+
|
|
122
|
+
Repeat for **every distinct** policy or recipe the conversation supports.
|
|
123
|
+
|
|
124
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
125
|
+
## Context of user interactions
|
|
126
|
+
{agent_context_prompt}
|
|
127
|
+
|
|
128
|
+
When reviewing the conversation, pay special attention to whether the agent explored all available tools to address the user's stated needs before accepting a negative outcome (e.g., cancellation, downgrade, churn, rejection).
|
|
129
|
+
|
|
130
|
+
## Playbook Focus
|
|
131
|
+
{extraction_definition_prompt}
|
|
132
|
+
|
|
133
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
134
|
+
## Tool Usage Analysis
|
|
135
|
+
Tool calls in the conversation appear as `[used tool: tool_name({{"param": "value"}})]` prefixes on agent messages. A single message may have multiple `[used tool: ...]` prefixes when the agent called several tools in one turn. Analyze them for these patterns:
|
|
136
|
+
|
|
137
|
+
[Available Tools]
|
|
138
|
+
{tool_can_use}
|
|
139
|
+
|
|
140
|
+
1. **Wrong tool selected** — feeds Correction SOPs.
|
|
141
|
+
2. **Suboptimal tool inputs** — feeds Correction SOPs.
|
|
142
|
+
3. **Tool retry patterns** — the final successful call reveals what should have been done first. For Correction SOPs, extract the lesson. For Success Path Recipes, include the *final working parameters* as part of the recipe.
|
|
143
|
+
4. **Missed tool usage** — feeds Correction SOPs.
|
|
144
|
+
5. **Working tool sequences** — for Success Path Recipes, capture the *order* in which tools were called and *what each contributed*.
|
|
145
|
+
|
|
146
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
147
|
+
## Blocking Issue Detection
|
|
148
|
+
|
|
149
|
+
When the agent could not complete the user's request because a capability was missing, populate `blocking_issue` to capture the root cause separately from the corrective action.
|
|
150
|
+
|
|
151
|
+
Populate `blocking_issue` when:
|
|
152
|
+
- The agent tried to use a tool that does not exist in its toolset
|
|
153
|
+
- The agent was denied permission to perform an action
|
|
154
|
+
- An external service or dependency was unavailable
|
|
155
|
+
- A policy or configuration prevented the agent from acting
|
|
156
|
+
|
|
157
|
+
Key principle: **Separate diagnosis from prescription.** The `blocking_issue` captures WHY the agent was blocked. The `content` should describe what the agent should avoid and what it should do instead — but ONLY actions grounded in the conversation, not invented workarounds.
|
|
158
|
+
|
|
159
|
+
The 4 `kind` values:
|
|
160
|
+
- `missing_tool` — A tool the agent needs does not exist in its current toolset
|
|
161
|
+
- `permission_denied` — The agent lacks authorization to perform the required action
|
|
162
|
+
- `external_dependency` — An external service, API, or resource is unavailable
|
|
163
|
+
- `policy_restriction` — A policy or configuration rule prevents the action
|
|
164
|
+
|
|
165
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
166
|
+
## Output Format (Strict JSON)
|
|
167
|
+
|
|
168
|
+
Return a JSON object with a single key `"playbooks"` whose value is a list of zero or more playbook entries. Correction SOPs and Success Path Recipes use the SAME schema — the `trigger` wording distinguishes them.
|
|
169
|
+
|
|
170
|
+
{{
|
|
171
|
+
"playbooks": [
|
|
172
|
+
{{
|
|
173
|
+
"rationale": "1-2 sentence summary: for a Correction SOP, what implicit expectation was violated. For a Success Path Recipe, why this recipe captures transferable value.",
|
|
174
|
+
"trigger": "The problem or situation where the agent's default was wrong, OR the task type for a recipe.",
|
|
175
|
+
"blocking_issue": {{
|
|
176
|
+
"kind": "missing_tool | permission_denied | external_dependency | policy_restriction",
|
|
177
|
+
"details": "What capability is missing and why it blocks the request"
|
|
178
|
+
}},
|
|
179
|
+
"content": "The main actionable content — grounded in the conversation. For a Correction SOP: what the agent should do or avoid based on evidence from user feedback. For a Success Path Recipe: the step-by-step recipe with concrete values."
|
|
180
|
+
}}
|
|
181
|
+
]
|
|
182
|
+
}}
|
|
183
|
+
|
|
184
|
+
Note: `"blocking_issue"` is OPTIONAL on each entry — include ONLY when the agent could not complete the user's request due to a missing capability or external constraint.
|
|
185
|
+
|
|
186
|
+
**How many entries to return:**
|
|
187
|
+
* Emit one entry per distinct Correction SOP.
|
|
188
|
+
* Emit one entry per distinct Success Path Recipe **only when the trajectory contained removable inefficiency** (see Category 2, condition 2). Clean first-try successes yield zero recipes — padding the playbook with recipes that just restate an already-efficient path degrades its value.
|
|
189
|
+
* Correction SOPs are independent of recipe emission: extract a SOP whenever a correction signal is present, regardless of whether any recipe qualifies.
|
|
190
|
+
|
|
191
|
+
Return an empty list only when truly nothing applies:
|
|
192
|
+
|
|
193
|
+
{{"playbooks": []}}
|
|
194
|
+
|
|
195
|
+
**Never split a single policy across multiple entries; never merge two independent policies into one.**
|
|
196
|
+
|
|
197
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
198
|
+
## Examples
|
|
199
|
+
|
|
200
|
+
**Example 1 — Correction SOP (grounded in user feedback):**
|
|
201
|
+
* **User turn 2:** "Don't give me the code yet, explain the strategy first."
|
|
202
|
+
* **Output:**
|
|
203
|
+
{{
|
|
204
|
+
"playbooks": [
|
|
205
|
+
{{
|
|
206
|
+
"rationale": "The agent jumped straight to code, but the user wanted to understand the approach first before seeing implementation.",
|
|
207
|
+
"trigger": "User asks for help with complex implementations or architectural decisions.",
|
|
208
|
+
"content": "When users ask for help with complex implementations, present the high-level strategy first before generating code. The user explicitly asked for the approach to be explained before seeing code — jumping straight to implementation wastes effort if the approach is wrong."
|
|
209
|
+
}}
|
|
210
|
+
]
|
|
211
|
+
}}
|
|
212
|
+
|
|
213
|
+
**Example 2 — Correction SOP (knowledge gap — grounded, no hallucinated fix):**
|
|
214
|
+
* **Agent fabricated order tracking info. User called it out: "Did you actually look it up or are you just guessing?"**
|
|
215
|
+
* **Output:**
|
|
216
|
+
{{
|
|
217
|
+
"playbooks": [
|
|
218
|
+
{{
|
|
219
|
+
"rationale": "The agent fabricated specific order status details despite not having access to order tracking systems, causing the user to lose trust when the info contradicted their records.",
|
|
220
|
+
"trigger": "User asks agent to look up specific account or order data that requires system access the agent does not have.",
|
|
221
|
+
"blocking_issue": {{
|
|
222
|
+
"kind": "missing_tool",
|
|
223
|
+
"details": "Agent lacks access to order tracking or customer account lookup systems."
|
|
224
|
+
}},
|
|
225
|
+
"content": "Do not fabricate or guess specific data points (order status, tracking info, delivery dates) when you do not have access to the underlying system. If you cannot look something up, say so immediately rather than presenting assumptions as facts. The user's trust was broken because the agent presented made-up timelines as real data."
|
|
226
|
+
}}
|
|
227
|
+
]
|
|
228
|
+
}}
|
|
229
|
+
Note: the content does NOT invent an escalation path or suggest "check your email" — it only describes what the agent should avoid (the observed mistake) and why, based on what happened in the conversation.
|
|
230
|
+
|
|
231
|
+
**Example 3 — Success Path Recipe:**
|
|
232
|
+
* **Agent successfully computed audit sample sizes from a tabular dataset.**
|
|
233
|
+
* **Output:**
|
|
234
|
+
{{
|
|
235
|
+
"playbooks": [
|
|
236
|
+
{{
|
|
237
|
+
"rationale": "Captures the audit-sample selection structure that the original trajectory converged to after a brief sampling-at-random detour.",
|
|
238
|
+
"trigger": "Selecting an audit sample from a tabular dataset using risk metrics, multi-criteria filtering, and period-over-period variance.",
|
|
239
|
+
"content": "(1) Load the dataset with a tabular reader. (2) Compute period-over-period variance per row. (3) Compute Cochran sample size (z=1.645, p=0.5) and apply finite-population correction. (4) Filter rows by risk thresholds (variance threshold, mandatory entities, target metric codes, all-zero rows). (5) Write the sample to a spreadsheet with separate Sample and Calculation tabs. Detour to skip: do not start by sampling at random — variance plus filter rules drive the selection."
|
|
240
|
+
}}
|
|
241
|
+
]
|
|
242
|
+
}}
|
|
243
|
+
|
|
244
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
245
|
+
## Rules for Output Fields
|
|
246
|
+
|
|
247
|
+
* The top-level response MUST be a JSON object with a single `"playbooks"` key whose value is a list (possibly empty)
|
|
248
|
+
* Each entry in `"playbooks"` MUST satisfy ALL of the following:
|
|
249
|
+
* "rationale" is REQUIRED — 1-2 sentence summary of why this entry captures reusable value
|
|
250
|
+
* "trigger" is REQUIRED — situation/condition for Correction SOPs OR task-type descriptor for Success Path Recipes (used as search key)
|
|
251
|
+
* "content" is REQUIRED — the main actionable content. MUST satisfy both joint requirements (grounded in conversation evidence AND generalized to apply in other repos). See Content Grounding Rules.
|
|
252
|
+
* Each playbook MUST correspond to a triggering agent behavior OR a successful task completion in the trajectory
|
|
253
|
+
* Vague, stylistic, or unanchored advice is invalid for BOTH categories
|
|
254
|
+
* Each entry must describe a **distinct, independent** policy or recipe
|