claude-smart 0.2.43 → 0.2.45
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 +2 -2
- package/plugin/.claude-plugin/plugin.json +2 -2
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/README.md +21 -1
- package/plugin/pyproject.toml +3 -3
- package/plugin/scripts/_lib.sh +72 -28
- package/plugin/scripts/backend-service.sh +55 -7
- package/plugin/scripts/cli.sh +2 -1
- package/plugin/scripts/dashboard-service.sh +7 -5
- package/plugin/scripts/ensure-plugin-root.sh +1 -0
- package/plugin/scripts/hook_entry.sh +7 -5
- package/plugin/scripts/smart-install.sh +2 -2
- package/plugin/src/README.md +57 -0
- package/plugin/uv.lock +126 -5
- package/plugin/vendor/reflexio/.env.example +9 -0
- package/plugin/vendor/reflexio/pyproject.toml +5 -2
- package/plugin/vendor/reflexio/reflexio/cli/bootstrap_config.py +0 -1
- package/plugin/vendor/reflexio/reflexio/cli/commands/setup_cmd.py +7 -4
- package/plugin/vendor/reflexio/reflexio/cli/env_loader.py +4 -4
- package/plugin/vendor/reflexio/reflexio/lib/_storage_labels.py +2 -2
- package/plugin/vendor/reflexio/reflexio/models/api_schema/domain/entities.py +13 -4
- package/plugin/vendor/reflexio/reflexio/models/api_schema/retriever_schema.py +3 -1
- package/plugin/vendor/reflexio/reflexio/models/api_schema/validators.py +59 -6
- package/plugin/vendor/reflexio/reflexio/models/config_schema.py +1 -1
- package/plugin/vendor/reflexio/reflexio/server/README.md +7 -1
- package/plugin/vendor/reflexio/reflexio/server/api.py +188 -34
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/README.md +34 -0
- package/plugin/vendor/reflexio/reflexio/server/api_endpoints/publisher_api.py +33 -11
- package/plugin/vendor/reflexio/reflexio/server/llm/embedding_service.py +278 -29
- package/plugin/vendor/reflexio/reflexio/server/llm/litellm_client.py +457 -181
- package/plugin/vendor/reflexio/reflexio/server/llm/llm_utils.py +28 -0
- package/plugin/vendor/reflexio/reflexio/server/llm/model_defaults.py +22 -12
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/embedding_service_provider.py +137 -9
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/local_embedding_provider.py +1 -1
- package/plugin/vendor/reflexio/reflexio/server/llm/providers/nomic_embedding_provider.py +36 -3
- package/plugin/vendor/reflexio/reflexio/server/llm/rerank/cross_encoder_reranker.py +13 -3
- package/plugin/vendor/reflexio/reflexio/server/llm/tools.py +17 -0
- package/plugin/vendor/reflexio/reflexio/server/prompt/prompt_bank/playbook_consolidation/v2.3.0.prompt.md +1 -1
- 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.2.0.prompt.md +27 -23
- 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/v3.3.0.prompt.md +19 -9
- package/plugin/vendor/reflexio/reflexio/server/services/README.md +58 -0
- package/plugin/vendor/reflexio/reflexio/server/services/agent_success_evaluation/group_evaluation_runner.py +1 -5
- package/plugin/vendor/reflexio/reflexio/server/services/base_generation_service.py +44 -2
- package/plugin/vendor/reflexio/reflexio/server/services/embedding_text.py +62 -0
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/pending_tool_call_dispatch.py +8 -1
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/resumable_agent.py +91 -24
- package/plugin/vendor/reflexio/reflexio/server/services/extraction/resume_worker.py +3 -1
- package/plugin/vendor/reflexio/reflexio/server/services/extractor_config_utils.py +6 -3
- package/plugin/vendor/reflexio/reflexio/server/services/extractor_interaction_utils.py +1 -1
- package/plugin/vendor/reflexio/reflexio/server/services/generation_service.py +18 -5
- package/plugin/vendor/reflexio/reflexio/server/services/operation_state_utils.py +2 -2
- package/plugin/vendor/reflexio/reflexio/server/services/playbook/playbook_consolidator.py +88 -3
- package/plugin/vendor/reflexio/reflexio/server/services/profile/profile_deduplicator.py +36 -5
- package/plugin/vendor/reflexio/reflexio/server/services/profile/profile_generation_service.py +6 -3
- package/plugin/vendor/reflexio/reflexio/server/services/reflection/reflection_service.py +6 -3
- package/plugin/vendor/reflexio/reflexio/server/services/retrieval/relevance_floor.py +32 -22
- package/plugin/vendor/reflexio/reflexio/server/services/service_utils.py +89 -4
- package/plugin/vendor/reflexio/reflexio/server/services/storage/sqlite_storage/_agent_run.py +46 -1
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_agent_run.py +12 -0
- package/plugin/vendor/reflexio/reflexio/server/services/storage/storage_base/_operations.py +1 -1
- package/plugin/vendor/reflexio/reflexio/server/services/unified_search_service.py +8 -4
|
@@ -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.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
active:
|
|
2
|
+
active: false
|
|
3
3
|
description: "Context setting prompt for resumable playbook extraction. Every claim must be grounded in the conversation and generalized to a reusable task context; both requirements apply jointly to Correction SOPs and Success Path Recipes."
|
|
4
|
-
changelog: "v4.2.0: adds emergent skill-convention guidance for structuring multi-aspect playbook content as a small set of grouped do/avoid rules (no schema change). v4.1.7: adds resumable extraction guidance, names legacy fallback and malformed-input branches in boundary-change recipes, and avoids a polarity output field. (in-place 2026-05-30: tool-oriented finish_extraction output framing; deprecated and removed blocking_issue.) (in-place 2026-05-30: clarify in the Output Format section that finish_extraction may be preceded by ask_human/attach_pending_info_request; restructure examples into one no-tool example plus a worked ask_human and attach_pending_info_request example; stress that ask_human is rare and reserved for critical missing org-level facts — finish_extraction alone is the norm.) (in-place 2026-05-30: condense the resumable guidance — state finish-required/optional once, replace the duplicated Output Format block with a one-line pointer, and trim example prose.)"
|
|
4
|
+
changelog: "v4.2.0: adds emergent skill-convention guidance for structuring multi-aspect playbook content as a small set of grouped do/avoid rules (no schema change). v4.1.7: adds resumable extraction guidance, names legacy fallback and malformed-input branches in boundary-change recipes, and avoids a polarity output field. (in-place 2026-05-30: tool-oriented finish_extraction output framing; deprecated and removed blocking_issue.) (in-place 2026-05-30: clarify in the Output Format section that finish_extraction may be preceded by ask_human/attach_pending_info_request; restructure examples into one no-tool example plus a worked ask_human and attach_pending_info_request example; stress that ask_human is rare and reserved for critical missing org-level facts — finish_extraction alone is the norm.) (in-place 2026-05-30: condense the resumable guidance — state finish-required/optional once, replace the duplicated Output Format block with a one-line pointer, and trim example prose.) (in-place 2026-06-03: consolidate and shorten the ask_human condition: ask only for missing shared context needed to know what to do, while still finishing extraction.) (in-place 2026-06-03: frame finish_extraction as the final completion tool and pending-info tools as intermediate.) (in-place 2026-06-03: clarify that empty finish_extraction alone must not replace ask_human when the ask_human condition applies.) (in-place 2026-06-04: clarify ask_human and attach_pending_info_request are alternatives for the same gap, not a sequence.)"
|
|
5
5
|
variables:
|
|
6
6
|
- agent_context_prompt
|
|
7
7
|
- extraction_definition_prompt
|
|
@@ -13,12 +13,22 @@ Your job is to extract **reusable patterns** from agent trajectories that help s
|
|
|
13
13
|
━━━━━━━━━━━━━━━━━━━━━━
|
|
14
14
|
## Resumable Extraction Mode
|
|
15
15
|
|
|
16
|
-
When tool calling is available,
|
|
16
|
+
When tool calling is available, tools have two roles:
|
|
17
17
|
|
|
18
|
-
* `ask_human`
|
|
19
|
-
*
|
|
18
|
+
* **Intermediate tools:** `ask_human` and `attach_pending_info_request` gather missing context before finalizing.
|
|
19
|
+
* **Final completion tool:** `finish_extraction` commits the playbooks for this run. Call it once, after any needed intermediate tool calls.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Use `ask_human` for missing shared/org context needed to know **what to do** in a durable playbook: the positive action, exact target, procedure, policy, or standard. This is okay even when other useful playbooks can still be extracted now.
|
|
22
|
+
|
|
23
|
+
Choose exactly one intermediate path per missing fact: use `attach_pending_info_request` when Prior Knowledge already lists a matching pending request; otherwise use `ask_human`. Do not call `attach_pending_info_request` for a pending request that this same run just created with `ask_human`.
|
|
24
|
+
|
|
25
|
+
Do not ask for user-scoped/private facts, context derivable from the trajectory, agent context, tool list, or Prior Knowledge, complete avoidance-only rules, or merely nice-to-have details.
|
|
26
|
+
|
|
27
|
+
If an intermediate tool is needed, call exactly one of the two intermediate tools before `finish_extraction`. Then finalize the current run with any independently valid playbooks now, including avoidance rules; if none are valid without the answer, finalize with `{{"playbooks": []}}`.
|
|
28
|
+
|
|
29
|
+
When the `ask_human` condition applies, an `ask_human` tool call is required before finalization. Do not replace the question with `finish_extraction` alone, even with an empty playbook list.
|
|
30
|
+
|
|
31
|
+
Tool-call discipline: create actual tool calls; do not merely write "call ask_human" inside a playbook's `content`, `rationale`, or plain text, and do not invent missing "what to do" details.
|
|
22
32
|
|
|
23
33
|
You extract TWO CATEGORIES of patterns, and a single trajectory can contain BOTH:
|
|
24
34
|
|
|
@@ -126,7 +136,7 @@ Grounding constrains the *source* of a claim (it must come from the conversation
|
|
|
126
136
|
- Prescribes solutions the agent has no evidence it can actually do
|
|
127
137
|
- Adds generic customer-service advice not grounded in this specific interaction
|
|
128
138
|
|
|
129
|
-
**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.
|
|
139
|
+
**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. If the missing "what to do" detail satisfies the `ask_human` condition above, use the tool; otherwise emit only the grounded avoidance rule or no playbook.
|
|
130
140
|
|
|
131
141
|
**Rule of thumb (both checks must pass):**
|
|
132
142
|
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.
|
|
@@ -141,7 +151,7 @@ For **Correction SOPs**:
|
|
|
141
151
|
3. Identify the violated implicit expectation
|
|
142
152
|
4. Draft the `trigger` (the problem or situation)
|
|
143
153
|
5. Tautology Check (see above)
|
|
144
|
-
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.
|
|
154
|
+
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; use `ask_human` only when the condition above applies.
|
|
145
155
|
|
|
146
156
|
For **Success Path Recipes**:
|
|
147
157
|
1. Identify whether the agent completed the task successfully
|
|
@@ -192,9 +202,9 @@ When the guidance for a playbook covers multiple steps or sub-aspects of a task,
|
|
|
192
202
|
━━━━━━━━━━━━━━━━━━━━━━
|
|
193
203
|
## Output Format (Strict JSON)
|
|
194
204
|
|
|
195
|
-
|
|
205
|
+
Complete the run by calling the final completion tool, `finish_extraction`, with a single JSON argument: an object with one key `"playbooks"` whose value is a list of zero or more playbook entries. Put the JSON in the tool call — do not write it as a plain-text reply. Correction SOPs and Success Path Recipes use the SAME schema — the `trigger` wording distinguishes them. Do not add markdown headings, prose, comments, chain-of-thought, or extra top-level keys; put all natural-language guidance inside the allowed entry fields.
|
|
196
206
|
|
|
197
|
-
|
|
207
|
+
When an intermediate tool is needed, call it before the final `finish_extraction` call. Examples 2 and 3 below show those shapes.
|
|
198
208
|
|
|
199
209
|
{{
|
|
200
210
|
"playbooks": [
|
|
@@ -239,22 +249,16 @@ One trajectory can yield both categories as separate entries in one call. Here t
|
|
|
239
249
|
}}
|
|
240
250
|
The `trigger` wording distinguishes them: a problem-situation trigger marks a Correction SOP, a task-type trigger marks a Success Path Recipe.
|
|
241
251
|
|
|
242
|
-
**Example 2 —
|
|
243
|
-
The agent deployed a backend service; the user said "use our canonical deployment target — you know the internal standard" but never named it, and no pending request covers it.
|
|
244
|
-
* **
|
|
252
|
+
**Example 2 — `ask_human` then empty `finish_extraction`:**
|
|
253
|
+
The agent deployed a backend service; the user said "use our canonical deployment target — you know the internal standard" but never named it, and no pending request covers it. The durable playbook must name the exact target because the deployment path is target-specific, so a generic "confirm the target" recipe would be invalid. Ask for the target, then still finish with no playbooks for this run.
|
|
254
|
+
* **First, call `ask_human` as a tool call:**
|
|
245
255
|
{{"question": "What is this org's canonical deployment target for backend services? The trajectory references an 'internal standard' but never names it.", "answer_format": "deployment target / platform name", "tags": ["deployment", "org-standard"]}}
|
|
246
|
-
* **Then call `finish_extraction
|
|
256
|
+
* **Then call `finish_extraction` as a separate tool call:**
|
|
247
257
|
{{
|
|
248
|
-
"playbooks": [
|
|
249
|
-
{{
|
|
250
|
-
"rationale": "Success Path Recipe for deploying a backend service; the exact target is an unresolved org standard, so the recipe stays target-agnostic and is sharpened when the answer resolves.",
|
|
251
|
-
"trigger": "Deploying a backend service that must follow the org's canonical deployment target.",
|
|
252
|
-
"content": "Confirm the org's canonical deployment target before deploying rather than assuming a default; deploy to that target and verify the service is reachable after deploy. Detour to skip: do not deploy to an ad-hoc target chosen without confirming the org standard."
|
|
253
|
-
}}
|
|
254
|
-
]
|
|
258
|
+
"playbooks": []
|
|
255
259
|
}}
|
|
256
260
|
|
|
257
|
-
**Example 3 —
|
|
261
|
+
**Example 3 — `attach_pending_info_request` then `finish_extraction`:**
|
|
258
262
|
Same gap as Example 2, but Prior Knowledge already lists a pending request for that exact question — so attach to it instead of asking again, then finish.
|
|
259
263
|
* **Prior Knowledge contains:**
|
|
260
264
|
```
|
|
@@ -264,7 +268,7 @@ Pending requests:
|
|
|
264
268
|
```
|
|
265
269
|
* **Call `attach_pending_info_request`:**
|
|
266
270
|
{{"pending_tool_call_id": "ptc_7f3a91", "why_relevant": "Same undecided org deployment standard; resume when answered."}}
|
|
267
|
-
* **Then call `finish_extraction`** with the same
|
|
271
|
+
* **Then call `finish_extraction`** with the same empty result as Example 2. Only ever pass a `pending_tool_call_id` that appears verbatim in the Prior Knowledge "Pending requests" section.
|
|
268
272
|
|
|
269
273
|
━━━━━━━━━━━━━━━━━━━━━━
|
|
270
274
|
## Rules for Output Fields
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
---
|
|
2
|
+
active: false
|
|
3
|
+
description: "Context setting prompt for resumable playbook extraction. Every claim must be grounded in the conversation and generalized to a reusable task context; both requirements apply jointly to Correction SOPs and Success Path Recipes."
|
|
4
|
+
changelog: "v4.2.2: replaces output examples with compact tool-call and JSON-shape guidance, while preserving the resumable extraction contract. v4.2.1: negative/avoid guidance cannot contradict the final verified implementation or final evaluation. v4.2.0: adds emergent skill-convention guidance for structuring multi-aspect playbook content as a small set of grouped do/avoid rules (no schema change). v4.1.7: adds resumable extraction guidance, names legacy fallback and malformed-input branches in boundary-change recipes, and avoids a polarity output field. (in-place 2026-05-30: tool-oriented finish_extraction output framing; deprecated and removed blocking_issue.) (in-place 2026-05-30: clarify in the Output Format section that finish_extraction may be preceded by ask_human/attach_pending_info_request; restructure examples into one no-tool example plus a worked ask_human and attach_pending_info_request example; stress that ask_human is rare and reserved for critical missing org-level facts — finish_extraction alone is the norm.) (in-place 2026-05-30: condense the resumable guidance — state finish-required/optional once, replace the duplicated Output Format block with a one-line pointer, and trim example prose.) (in-place 2026-06-03: consolidate and shorten the ask_human condition: ask only for missing shared context needed to know what to do, while still finishing extraction.) (in-place 2026-06-03: frame finish_extraction as the final completion tool and pending-info tools as intermediate.) (in-place 2026-06-03: clarify that empty finish_extraction alone must not replace ask_human when the ask_human condition applies.) (in-place 2026-06-04: clarify ask_human and attach_pending_info_request are alternatives for the same gap, not a sequence.)"
|
|
5
|
+
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. Extract task recipes, not transcripts: prefer entries that change a future agent's first actions, constraints, checks, or avoided detours.
|
|
12
|
+
|
|
13
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
14
|
+
## Resumable Extraction Mode
|
|
15
|
+
|
|
16
|
+
When tool calling is available, tools have two roles:
|
|
17
|
+
|
|
18
|
+
* **Intermediate tools:** `ask_human` and `attach_pending_info_request` gather missing context before finalizing.
|
|
19
|
+
* **Final completion tool:** `finish_extraction` commits the playbooks for this run. Call it once, after any needed intermediate tool calls.
|
|
20
|
+
|
|
21
|
+
Use `ask_human` for missing shared/org context needed to know **what to do** in a durable playbook: the positive action, exact target, procedure, policy, or standard. This is okay even when other useful playbooks can still be extracted now.
|
|
22
|
+
|
|
23
|
+
Choose exactly one intermediate path per missing fact: use `attach_pending_info_request` when Prior Knowledge already lists a matching pending request; otherwise use `ask_human`. Do not call `attach_pending_info_request` for a pending request that this same run just created with `ask_human`.
|
|
24
|
+
|
|
25
|
+
Do not ask for user-scoped/private facts, context derivable from the trajectory, agent context, tool list, or Prior Knowledge, complete avoidance-only rules, or merely nice-to-have details.
|
|
26
|
+
|
|
27
|
+
If an intermediate tool is needed, call exactly one of the two intermediate tools before `finish_extraction`. Then finalize the current run with any independently valid playbooks now, including avoidance rules; if none are valid without the answer, finalize with `{{"playbooks": []}}`.
|
|
28
|
+
|
|
29
|
+
When the `ask_human` condition applies, an `ask_human` tool call is required before finalization. Do not replace the question with `finish_extraction` alone, even with an empty playbook list.
|
|
30
|
+
|
|
31
|
+
Tool-call discipline: create actual tool calls; do not merely write "call ask_human" inside a playbook's `content`, `rationale`, or plain text, and do not invent missing "what to do" details.
|
|
32
|
+
|
|
33
|
+
You extract TWO CATEGORIES of patterns, and a single trajectory can contain BOTH:
|
|
34
|
+
|
|
35
|
+
1. **Correction SOPs** — patterns learned from user-correction signals (multi-turn dialogues where the user pushed back on the agent's default behavior).
|
|
36
|
+
2. **Success Path Recipes** — compact solution paths extracted from successful task completions, so a future run of a similar task can go directly to the decisive source, action, and verification instead of re-discovering them.
|
|
37
|
+
|
|
38
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
39
|
+
## Category 1 — Correction SOPs
|
|
40
|
+
|
|
41
|
+
Extract a **Correction SOP** when ALL are true:
|
|
42
|
+
1. The agent performed an action, assumption, or default behavior.
|
|
43
|
+
2. The user signaled this behavior was incorrect, inefficient, or misaligned.
|
|
44
|
+
3. The correction implies a **better default workflow** for similar future requests.
|
|
45
|
+
|
|
46
|
+
### Valid Correction Signals
|
|
47
|
+
Look for cross-turn causal patterns, not isolated messages.
|
|
48
|
+
|
|
49
|
+
Valid signals include:
|
|
50
|
+
* User correcting or rejecting the agent's approach
|
|
51
|
+
* User redirecting the agent to a different mode or level of detail
|
|
52
|
+
* User expressing dissatisfaction with how the agent behaved
|
|
53
|
+
* User clarifying expectations that contradict the agent's behavior
|
|
54
|
+
* Agent retrying a tool call with different inputs after getting poor or irrelevant results (self-correction)
|
|
55
|
+
* Agent switching from one tool to another within the same task after inadequate results
|
|
56
|
+
|
|
57
|
+
You MUST identify the triggering agent behavior
|
|
58
|
+
(assumption made, default chosen, constraint ignored, or question not asked).
|
|
59
|
+
|
|
60
|
+
### Trigger Quality
|
|
61
|
+
|
|
62
|
+
A valid `trigger` describes the **problem or situation**, NOT the user's explicitly stated preference.
|
|
63
|
+
* **BAD:** "User requests CLI tools." (Just restates the user's explicit ask.)
|
|
64
|
+
* **GOOD:** "User reports timeout or performance failures on large data transfers (>10TB)."
|
|
65
|
+
|
|
66
|
+
Both `trigger` and `content` must satisfy the joint grounded-and-generalized requirement defined in Content Grounding Rules below.
|
|
67
|
+
|
|
68
|
+
### Tautology Check (Correction SOPs only)
|
|
69
|
+
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.
|
|
70
|
+
|
|
71
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
72
|
+
## Category 2 — Success Path Recipes
|
|
73
|
+
|
|
74
|
+
Extract a **Success Path Recipe** when ALL are true:
|
|
75
|
+
1. The agent successfully completed the task (produced final deliverables, resolved the user's request, or reached the intended end state).
|
|
76
|
+
2. The trajectory contains **reusable task structure** — at least one of:
|
|
77
|
+
- A failed tool call before a successful retry
|
|
78
|
+
- Parameters that had to be tuned after returning wrong or incomplete results
|
|
79
|
+
- A tool swapped mid-task after the first choice did not work
|
|
80
|
+
- A redundant or dead-end step that did not contribute to the final answer
|
|
81
|
+
- Discovery work (reading docs, probing formats, sampling data) that a future agent, armed with what was learned, could skip
|
|
82
|
+
- A decisive source, artifact, owner, signal, constraint, or intermediate result that determined the solution
|
|
83
|
+
- A narrow verification that proved the result before broader checks
|
|
84
|
+
3. A future agent could act differently because of the recipe: start in a better place, choose a better action, verify earlier, or skip a detour.
|
|
85
|
+
|
|
86
|
+
If the agent reached the answer on a clean first-try path with no reusable decision, verification, or shortcut, **do not emit a recipe** — there is nothing to optimize.
|
|
87
|
+
|
|
88
|
+
A Success Path Recipe does NOT require a user-correction signal.
|
|
89
|
+
|
|
90
|
+
### Success Path content format
|
|
91
|
+
|
|
92
|
+
The `content` field is the **optimized, replayable path** — the straight-line sequence the original trajectory converged to, with detours removed. Use this compact shape: start at the decisive source/artifact/signal; take the ordered actions that solved it; carry forward any constraint or edge condition that was necessary for correctness; run the narrow verification; skip the named detour. Name the tool category, parameter shape, artifact role, or evidence cue when it helps retrieval.
|
|
93
|
+
|
|
94
|
+
A strong recipe answers, when the trajectory supports it:
|
|
95
|
+
- **Applies when:** the reusable situation class, not only this exact request.
|
|
96
|
+
- **Do:** the shortest successful action pattern.
|
|
97
|
+
- **Constraints:** preconditions, edge cases, options, or boundaries that changed the outcome.
|
|
98
|
+
- **Avoid:** plausible detours, failed approaches, or incomplete fixes from the session.
|
|
99
|
+
- **Validate:** the narrow check that proved the recipe before broader review.
|
|
100
|
+
|
|
101
|
+
Use the final verified implementation state as the source of truth. Include exact code, parameters, commands, or config values only when they are anchored in the final diff, final inspected file state, or final successful command. If a detail was changed, failed, or is not visible in that final evidence, write the reusable action pattern instead of an exact snippet; omit the stale detail or capture it as negative/avoid evidence.
|
|
102
|
+
|
|
103
|
+
If discovery found multiple analogous surfaces for the same invariant, carry that scope forward as a coverage checklist and verification target; do not collapse the recipe to the first edited or locally passing surface.
|
|
104
|
+
|
|
105
|
+
When the final code changes a value's representation, type, precision, ownership, or lifecycle, keep the recipe but carry the semantic constraints and validation cases a future agent must preserve. Treat the exact implementation as mandatory only when the session proved that representation choice.
|
|
106
|
+
|
|
107
|
+
When the fix refactors a boundary such as serialization, parsing, validation, adapters, or error handling, carry adjacent malformed-input and failure-path invariants into the recipe when the session inspected or tested them. Do not reduce the recipe to the new happy path if preserving the old error behavior was part of the explored surface.
|
|
108
|
+
|
|
109
|
+
If a final passing boundary change keeps legacy fallback branches, unknown-type handling, null/empty inputs, or malformed data behavior, name those branches explicitly as constraints. Future agents should be able to distinguish the complete passing recipe from an incomplete happy-path implementation.
|
|
110
|
+
|
|
111
|
+
For verification/setup detours, capture the reusable setup rule rather than a brittle command copy: the documented runner/source to consult, required working-directory or import-path relationship, missing declared dependency, and the failed assumption to avoid. Failed executable paths, wrong working directories, import-path errors, and missing declared dependencies all count as setup detours. Prioritize the pattern "failed command -> same goal succeeds with corrected path, environment, or dependency"; ignore benchmark sentinel/handoff mechanics unless they caused the task failure. If a failed setup command is followed by a successful retry and the lesson would change a future agent's first command, emit that setup recipe as its own playbook instead of folding it into the domain solution.
|
|
112
|
+
|
|
113
|
+
Keep entries concise — a quick reference, not a recap. Omit restated user feedback, log excerpts, and summary preambles.
|
|
114
|
+
|
|
115
|
+
End with one short line naming the detour from the original path that the reader should skip. Skip broad summaries, one-off facts, and domain details that would not change the next agent's actions. A generic "follow best practices" is worthless; a compact recipe plus the detour to skip is gold.
|
|
116
|
+
|
|
117
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
118
|
+
## Content Grounding Rules (CRITICAL)
|
|
119
|
+
|
|
120
|
+
Every entry — both Correction SOPs and Success Path Recipes — must satisfy two joint requirements:
|
|
121
|
+
|
|
122
|
+
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.
|
|
123
|
+
2. **Generalized** — the entry applies in a different task context with no access to this conversation. Restate private or one-off artifacts in terms of their reusable role; original concretes may appear only when they are retrieval keys needed to recognize the same situation class.
|
|
124
|
+
|
|
125
|
+
Grounding constrains the *source* of a claim (it must come from the conversation), not its *form*. A useful entry preserves concrete cues that help retrieval while explaining why they matter as part of a transferable role. The conversation is the evidence; the entry is the distilled, transferable rule.
|
|
126
|
+
|
|
127
|
+
**GOOD content** — grounded in evidence:
|
|
128
|
+
- Describes what the agent did wrong (traceable to a specific agent turn)
|
|
129
|
+
- Describes what the user wanted instead (traceable to a specific user turn)
|
|
130
|
+
- States what the agent should avoid doing (the observed mistake)
|
|
131
|
+
- If the agent lacks a capability, says so honestly without inventing a workaround
|
|
132
|
+
|
|
133
|
+
**BAD content** — hallucinated:
|
|
134
|
+
- Invents escalation paths ("transfer to the shipping team") when no such team was mentioned
|
|
135
|
+
- Invents specific procedures ("check the confirmation email for tracking links") when the user never mentioned these exist
|
|
136
|
+
- Prescribes solutions the agent has no evidence it can actually do
|
|
137
|
+
- Adds generic customer-service advice not grounded in this specific interaction
|
|
138
|
+
|
|
139
|
+
**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. If the missing "what to do" detail satisfies the `ask_human` condition above, use the tool; otherwise emit only the grounded avoidance rule or no playbook.
|
|
140
|
+
|
|
141
|
+
**Rule of thumb (both checks must pass):**
|
|
142
|
+
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.
|
|
143
|
+
2. *Generalized* — could a future agent in a similar task context, with no access to this conversation, apply the entry as written? If not, you've overfit — restate the pattern at the level of situation, artifact role, action sequence, verification, and detour.
|
|
144
|
+
|
|
145
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
146
|
+
## Reasoning Procedure (REQUIRED)
|
|
147
|
+
|
|
148
|
+
For **Correction SOPs**:
|
|
149
|
+
1. Identify user turns containing correction, rejection, or redirection
|
|
150
|
+
2. Trace backwards to the exact agent behavior that triggered it
|
|
151
|
+
3. Identify the violated implicit expectation
|
|
152
|
+
4. Draft the `trigger` (the problem or situation)
|
|
153
|
+
5. Tautology Check (see above)
|
|
154
|
+
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; use `ask_human` only when the condition above applies.
|
|
155
|
+
|
|
156
|
+
For **Success Path Recipes**:
|
|
157
|
+
1. Identify whether the agent completed the task successfully
|
|
158
|
+
2. Scan the trajectory for **reusable task structure**: decisive source/artifact/signal, ordered actions, narrow verification, failed approach, parameter retry, tool swap, redundant step, or discovery work a future agent could skip. If none are present, **stop — do not emit a recipe.**
|
|
159
|
+
3. Enumerate the final working approach as a sequence of tool categories, parameter shapes, artifact roles, evidence cues, ordered operations, correctness constraints, and verification signals
|
|
160
|
+
4. Frame the trigger as a reusable task-type description (domain + action)
|
|
161
|
+
5. Compose `content` as the **optimized straight-line path** — specific enough to replay without re-deriving anything, generalized enough to apply in a similar task context — and add one short line naming the detour from the original trajectory that the reader should skip. Preserve constraints and checks that made the final answer correct; those are often the difference between a useful recipe and a generic recap.
|
|
162
|
+
|
|
163
|
+
Repeat for **every distinct** policy or recipe the conversation supports. If a task has both a domain solution and a reusable setup or verification detour, emit separate entries for those independent lessons.
|
|
164
|
+
|
|
165
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
166
|
+
## Context of user interactions
|
|
167
|
+
{agent_context_prompt}
|
|
168
|
+
|
|
169
|
+
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).
|
|
170
|
+
|
|
171
|
+
## Playbook Focus
|
|
172
|
+
{extraction_definition_prompt}
|
|
173
|
+
|
|
174
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
175
|
+
## Tool Usage Analysis
|
|
176
|
+
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:
|
|
177
|
+
|
|
178
|
+
[Available Tools]
|
|
179
|
+
{tool_can_use}
|
|
180
|
+
|
|
181
|
+
1. **Wrong tool selected** — feeds Correction SOPs.
|
|
182
|
+
2. **Suboptimal tool inputs** — feeds Correction SOPs.
|
|
183
|
+
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.
|
|
184
|
+
4. **Missed tool usage** — feeds Correction SOPs.
|
|
185
|
+
5. **Working tool sequences** — for Success Path Recipes, capture the *order* in which tools were called and *what each contributed*.
|
|
186
|
+
|
|
187
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
188
|
+
## Action vs avoidance framing
|
|
189
|
+
|
|
190
|
+
Write each playbook in the form that best matches its evidence:
|
|
191
|
+
|
|
192
|
+
- Use direct action language for successful, neutral, or ambiguous evidence. This is the default and covers most entries.
|
|
193
|
+
- Use avoidance language only when the specific rule is grounded in a clear failure pattern: user pushback, self-correction away from an approach, external refutation, or explicit dislike.
|
|
194
|
+
|
|
195
|
+
When writing an avoidance rule, start `content` with `Avoid`, `Do not`, `Don't`, or `Never`, and make the `rationale` name the observed failure pattern. Negative or avoidance guidance must not contradict the final verified implementation state or final successful evaluation. Do not tell future agents to avoid a file, branch, parameter, command, API, or implementation shape that the final successful solution required; rewrite that evidence as investigation sequencing or omit it. Do not add a separate polarity field; downstream systems infer orientation from the wording and evidence.
|
|
196
|
+
|
|
197
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
198
|
+
## Structuring multi-aspect content
|
|
199
|
+
|
|
200
|
+
When the guidance for a playbook covers multiple steps or sub-aspects of a task, write `content` as a short set of rules grouped by sub-goal, rather than one dense sentence. Phrase each rule as a clear action (do) rule, or as an avoidance rule (`Avoid`/`Do not`/`Don't`/`Never`) when it names a failure to steer around. Keep it minimal — only the rules the evidence supports; a single-point playbook stays a single rule. Do not force structure where the guidance is atomic.
|
|
201
|
+
|
|
202
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
203
|
+
## Output Format (Strict JSON)
|
|
204
|
+
|
|
205
|
+
Complete the run by calling the final completion tool, `finish_extraction`, with a single JSON argument matching `StructuredPlaybookList`: `{{"playbooks": [<zero or more playbook objects>]}}`. Put the JSON in the tool call — do not write it as a plain-text reply. Correction SOPs and Success Path Recipes use the SAME schema — the `trigger` wording distinguishes them.
|
|
206
|
+
|
|
207
|
+
Each playbook object MUST include non-empty `rationale`, `trigger`, and `content`. Optional fields are `source_span`, `notes`, and `reader_angle`; omit them unless they add grounded value. Do not add markdown headings, prose, comments, chain-of-thought, or extra top-level keys; put all natural-language guidance inside the allowed entry fields.
|
|
208
|
+
|
|
209
|
+
When an intermediate tool is needed, call exactly one intermediate tool before the final `finish_extraction` call:
|
|
210
|
+
|
|
211
|
+
- `ask_human` argument shape: `{{"question": "<missing shared context needed to know what to do>", "answer_format": "<short expected answer shape>", "tags": ["<short topic tag>"]}}`.
|
|
212
|
+
- `attach_pending_info_request` argument shape: `{{"pending_tool_call_id": "<id copied exactly from Prior Knowledge>", "why_relevant": "<why the same missing fact blocks this durable playbook>"}}`.
|
|
213
|
+
|
|
214
|
+
The final `finish_extraction` call is still required after an intermediate tool call. If no independently valid playbooks can be extracted before the missing answer arrives, call `finish_extraction` with an empty `playbooks` list.
|
|
215
|
+
|
|
216
|
+
**How many entries to return:**
|
|
217
|
+
* Emit one entry per distinct Correction SOP.
|
|
218
|
+
* Emit one entry per distinct Success Path Recipe **only when the trajectory contained reusable task structure** (see Category 2, condition 2). Clean first-try successes with no reusable decision, verification, or shortcut yield zero recipes — padding the playbook with obvious recaps degrades its value.
|
|
219
|
+
* Correction SOPs are independent of recipe emission: extract a SOP whenever a correction signal is present, regardless of whether any recipe qualifies.
|
|
220
|
+
|
|
221
|
+
When truly nothing applies, call `finish_extraction` with an empty `playbooks` list.
|
|
222
|
+
|
|
223
|
+
**Never split a single policy across multiple entries; never merge two independent policies into one.**
|
|
224
|
+
|
|
225
|
+
## Rules for Output Fields
|
|
226
|
+
|
|
227
|
+
* The final `finish_extraction` argument MUST be a JSON object with a single `"playbooks"` key whose value is a list (possibly empty)
|
|
228
|
+
* Each entry in `"playbooks"` MUST satisfy ALL of the following:
|
|
229
|
+
* "rationale" is REQUIRED — 1-2 sentence summary of why this entry captures reusable value
|
|
230
|
+
* "trigger" is REQUIRED — situation/condition for Correction SOPs OR task-type descriptor for Success Path Recipes (used as search key)
|
|
231
|
+
* "content" is REQUIRED — the main actionable content. For a Success Path Recipe, this is the compact replay recipe: applies-when context, start point, ordered actions, necessary constraints, verification, and detour to skip. MUST satisfy both joint requirements (grounded in conversation evidence AND generalized to apply in other repos). See Content Grounding Rules.
|
|
232
|
+
* Each playbook MUST correspond to a triggering agent behavior OR a successful task completion in the trajectory
|
|
233
|
+
* Vague, stylistic, or unanchored advice is invalid for BOTH categories
|
|
234
|
+
* Each entry must describe a **distinct, independent** policy or recipe
|