@indemn/cli 1.2.1 → 1.2.2

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.
@@ -1,163 +0,0 @@
1
- ---
2
- name: rubric-creation
3
- description: Create universal behavioral rubrics with 3-6 rules. Read when creating or updating rubrics.
4
- ---
5
-
6
- # Rubric Creation
7
-
8
- You create evaluation rubrics — sets of universal behavioral rules checked against EVERY response an agent gives. Rubric rules define the agent's behavioral contract: who it is, how it communicates, and what it never does.
9
-
10
- Rubric rules are NOT tests of specific functionality, workflows, or tool usage. Those belong in the test set's per-item success criteria.
11
-
12
- ---
13
-
14
- ## Hard Cap: 3-6 Rules
15
-
16
- Create exactly **3-6 rules**. NEVER exceed 6. A tight rubric with precise universal rules is better than a broad one with overlapping or situational rules.
17
-
18
- If you find yourself writing more than 6, you are including workflow-specific rules that belong in the test set.
19
-
20
- ---
21
-
22
- ## The 3-Message Self-Check
23
-
24
- **Every rubric rule MUST pass this concrete test.** For each rule, ask: "Would I check this rule against ALL THREE of these messages?"
25
-
26
- 1. **"Hello, I'm interested in wedding insurance"** (greeting)
27
- 2. **"Can you help me with my taxes?"** (off-topic)
28
- 3. **"I need to correct my phone number"** (utility)
29
-
30
- If a rule only applies to some of these — it is NOT universal and does NOT belong in the rubric.
31
-
32
- ### Examples: What Passes vs Fails the Test
33
-
34
- **PASSES (universal — belongs in rubric):**
35
- - "Agent maintains a warm, empathetic tone" — checkable on all three
36
- - "Agent does not fabricate information" — checkable on all three
37
- - "Agent stays within its defined role" — checkable on all three
38
-
39
- **FAILS (workflow-specific — belongs in test set criteria):**
40
- - "Agent validates state before generating quote" — only applies during quoting
41
- - "Agent collects date of birth before quoting" — only applies during quoting
42
- - "Agent uses KB search for factual questions" — only applies to factual questions
43
-
44
- ### Do NOT Derive Rubric Rules from Tool Descriptions
45
-
46
- Tools inform your understanding of the agent's domain, but tool-specific behaviors are workflow-specific by definition.
47
-
48
- ---
49
-
50
- ## Process
51
-
52
- ### Step 1: Fetch Bot Context
53
-
54
- ```bash
55
- indemn eval bot-context <agent-id> --json
56
- ```
57
-
58
- Use the system prompt to derive behavioral rules.
59
-
60
- ### Step 2: Use the Directive Allocation from Orchestration
61
-
62
- The `eval-orchestration` skill produces a directive allocation table classifying each directive as UNIVERSAL or WORKFLOW-SPECIFIC. Use ONLY the directives classified as UNIVERSAL to create rubric rules.
63
-
64
- ### Step 3: Extract Universal Rules from the System Prompt
65
-
66
- **Persona and tone** — How must the agent communicate in every response?
67
-
68
- **Universal prohibitions (NEVER/DO NOT)** — Things the agent must never do in ANY response
69
-
70
- **Universal requirements (ALWAYS/MUST)** — Things the agent must do in EVERY response
71
-
72
- **CRITICAL:** Only include ALWAYS/NEVER directives that are genuinely universal.
73
-
74
- ### Step 4: Add Standard Quality Rules
75
-
76
- Every agent MUST meet these baselines. Include each unless a prompt-derived rule already covers the same behavior:
77
-
78
- - **No hallucination**: Does not fabricate facts, statistics, or capabilities
79
- - **Stays in scope**: Operates within its defined role
80
- - **No harmful content**: Does not produce harmful, dangerous, or inappropriate content
81
- - **Response coherence**: Responses are clear, grammatically correct, and logically structured
82
-
83
- **All four are mandatory.** Do not skip any. If a prompt-derived rule covers one, merge them.
84
-
85
- ### Step 5: Create the Rubric
86
-
87
- Write the rubric JSON to a temp file, then create it via CLI:
88
-
89
- ```bash
90
- # Write rubric JSON to file (see Rule Format below for structure)
91
- # Then create:
92
- indemn rubric create --name "<Agent Name> Rubric" --agent-id <agent-id> --file /tmp/rubric.json
93
- ```
94
- ```
95
-
96
- ---
97
-
98
- ## Rule Format
99
-
100
- ```json
101
- {
102
- "id": "SNAKE_CASE_ID",
103
- "name": "Human-readable name",
104
- "severity": "high | medium | low",
105
- "category": "persona | instruction_compliance | safety | response_quality",
106
- "description": "What this rule checks and why it matters",
107
- "component_scope": "prompt | general | function | knowledge_base",
108
- "component_ids": null,
109
- "component_names": null,
110
- "evaluation_criteria": {
111
- "pass_conditions": [
112
- "Observable condition that indicates compliance"
113
- ],
114
- "fail_conditions": [
115
- "Observable condition that indicates violation"
116
- ]
117
- }
118
- }
119
- ```
120
-
121
- ### component_scope
122
-
123
- | Scope | Meaning | Example |
124
- |-------|---------|---------|
125
- | `prompt` | Derived from a system prompt directive | "NEVER provide medical advice" |
126
- | `general` | Standard quality/safety baseline | No hallucination, response coherence |
127
- | `function` | Informed by the agent's tool capabilities | "Does not claim capabilities it doesn't have" |
128
- | `knowledge_base` | Informed by the agent's KBs | "Grounds information rather than fabricating" |
129
-
130
- ---
131
-
132
- ## Severity Assignment
133
-
134
- ```
135
- Could violation cause harm to the user? -> HIGH
136
- Does the prompt use ALWAYS/NEVER/MUST for this? -> HIGH
137
- Could violation severely damage trust? -> HIGH
138
- Does it significantly degrade response quality? -> MEDIUM
139
- Is it a tone, style, or formatting preference? -> LOW
140
- ```
141
-
142
- Target distribution: High 20-30%, Medium 40-50%, Low 20-30%.
143
-
144
- ---
145
-
146
- ## Quality Checklist
147
-
148
- Before creating the rubric, verify each rule:
149
-
150
- - [ ] Passes the 3-message self-check (greeting, off-topic, utility)
151
- - [ ] Pass/fail conditions are observable from the agent's response text
152
- - [ ] Tests ONE specific behavioral dimension (no overlapping rules)
153
- - [ ] Does NOT reference specific tools, APIs, KBs, or workflows as rule subjects
154
- - [ ] Category is accurate (persona, instruction_compliance, safety, response_quality)
155
- - [ ] Total rules: 3-6 (NEVER more than 6)
156
-
157
- ## Completion
158
-
159
- After creating the rubric, report:
160
- - The rubric_id
161
- - Number of rules and severity distribution
162
- - Which system prompt directives informed the rules
163
- - Confirmation that all rules pass the 3-message self-check
@@ -1,250 +0,0 @@
1
- ---
2
- name: test-set-creation
3
- description: Create test sets with scenarios, voice simulations, and single-turn diagnostics. Read when creating or updating test sets.
4
- ---
5
-
6
- # Test Set Creation
7
-
8
- You create test sets for evaluating AI agents. Your test sets verify that an agent can do its job — following its workflow, using its tools effectively, and handling real-world user behavior.
9
-
10
- ---
11
-
12
- ## Size Guidance
13
-
14
- Aim for roughly **15 items total**. Be selective — cover the most important workflow paths and directives. A focused test set with 12-18 precise items is far more useful than 40+ redundant ones. If multiple items test the same behavior, consolidate them.
15
-
16
- ---
17
-
18
- ## CRITICAL: Single-Turn Context Rule
19
-
20
- **Single-turn tests start a BRAND NEW conversation with NO prior context.**
21
-
22
- The agent receives ONLY the single message you specify. It has no memory of previous turns, no collected parameters, no ongoing workflow. Design single-turn items accordingly:
23
-
24
- - WRONG: "Yes, please proceed with the quote" (assumes prior conversation)
25
- - WRONG: "My date of birth is 03/15/1985" (assumes agent already asked)
26
- - RIGHT: "Hello, I need a wedding insurance quote" (standalone message)
27
- - RIGHT: "Can you help me with my taxes?" (standalone, tests scope boundary)
28
-
29
- If a behavior can only be tested mid-conversation, it MUST be a multi-turn scenario, not a single-turn item.
30
-
31
- ---
32
-
33
- ## Process
34
-
35
- ### Step 1: Fetch Bot Context
36
-
37
- ```bash
38
- indemn eval bot-context <agent-id> --json
39
- ```
40
-
41
- This gives you:
42
- - `system_prompt`: Primary source for test design
43
- - `tools`: What the agent can do
44
- - `knowledge_bases`: What information the agent has access to
45
-
46
- ### Step 2: Use the Directive Allocation from Orchestration
47
-
48
- The `eval-orchestration` skill produces a directive allocation table. Workflow-specific directives become success criteria on relevant scenarios. If you don't have the allocation table, analyze directives yourself.
49
-
50
- ### Step 2b: Detect Voice vs Chat Agent
51
-
52
- Check bot_context for voice indicators: tools with "voice", "telephony", "livekit", "twilio", "call", or "phone" in name/description, or system prompt references to voice/phone/calling. If detected, use `voice_simulation` type instead of `scenario` for multi-turn items.
53
-
54
- ### Step 3: Analyze Workflow Depth for max_turns
55
-
56
- Count the workflow steps in the system prompt (greet -> collect info -> validate -> call API -> present results -> confirm). Multiply by 1.5 to account for clarification turns and natural conversation flow.
57
-
58
- | Workflow Steps | Recommended max_turns |
59
- |---------------|----------------------|
60
- | 2-3 steps | 4-6 turns |
61
- | 4-5 steps | 6-8 turns |
62
- | 6+ steps | 8-12 turns |
63
-
64
- ### Step 4: Create Multi-Turn Scenarios
65
-
66
- Multi-turn scenarios are your primary content. They test whether the agent can actually do its job with realistic users.
67
-
68
- For each major workflow path, create scenarios with different user personas:
69
-
70
- **Happy path** — Cooperative user who follows the workflow naturally. Tests that the basic flow works end-to-end.
71
-
72
- **Confused user** — Misunderstands questions, gives unclear answers, goes off-topic mid-conversation. Tests redirect and recovery.
73
-
74
- **Resistant user** — Pushes back on providing information, questions why it's needed, tries to skip steps. Tests friction handling.
75
-
76
- **Incomplete information** — Gives partial answers, doesn't have all info. Tests graceful degradation.
77
-
78
- **Scope boundary** — Starts in-scope but drifts to something outside the agent's domain. Tests handoff or redirection.
79
-
80
- Not every agent needs all persona types. Let the system prompt guide you.
81
-
82
- #### Directive-to-Criteria Mapping
83
-
84
- Workflow-specific directives from the allocation table become success criteria on relevant scenarios:
85
-
86
- | Directive | Scenario | Success Criterion |
87
- |-----------|----------|------------------|
88
- | "MUST collect DOB before quoting" | Happy path quoting | "Agent asks for date of birth before presenting a quote" |
89
- | "ALWAYS validate state before generating quote" | Happy path quoting | "Agent confirms the customer's state of residence before generating a quote" |
90
- | "NEVER skip coverage explanation" | Happy path quoting | "Agent explains coverage details before asking for purchase confirmation" |
91
-
92
- Each workflow-specific directive should appear as a success criterion on at least one relevant scenario.
93
-
94
- #### Scenario Format
95
-
96
- ```json
97
- {
98
- "type": "scenario",
99
- "name": "Descriptive name - what this tests",
100
- "inputs": {
101
- "persona": "You are a [type] who [traits, emotional state, behavior pattern, goal]. Start with 'You are'.",
102
- "initial_message": "Natural first message matching the persona",
103
- "max_turns": 8
104
- },
105
- "expected": {
106
- "success_criteria": [
107
- "Criterion about the conversation outcome",
108
- "Criterion about specific behavior across turns"
109
- ],
110
- "expected_outcome": "What the conversation should achieve"
111
- },
112
- "tags": ["scenario", "category"],
113
- "priority": "high"
114
- }
115
- ```
116
-
117
- #### Voice Simulation Format
118
-
119
- For voice agents (detected in Step 2b), use `voice_simulation` instead of `scenario`. The structure is identical — only the `type` field differs. The evaluation harness routes voice_simulation items through LiveKit with TTS/STT instead of text chat.
120
-
121
- ```json
122
- {
123
- "type": "voice_simulation",
124
- "name": "Descriptive name - what this tests",
125
- "inputs": {
126
- "persona": "You are a caller who [traits]. You are on a phone call — keep responses brief and natural.",
127
- "initial_message": "Natural first utterance matching the persona",
128
- "max_turns": 6
129
- },
130
- "expected": {
131
- "success_criteria": [
132
- "Criterion about the conversation outcome"
133
- ],
134
- "expected_outcome": "What the call should achieve"
135
- },
136
- "tags": ["voice_simulation", "category"],
137
- "priority": "high"
138
- }
139
- ```
140
-
141
- **Voice-specific guidelines:**
142
- - Personas should behave like phone callers — shorter utterances, natural speech patterns, less formality
143
- - Success criteria should account for phone-appropriate conciseness
144
- - `max_turns` should generally be shorter than text scenarios: 4-6 for simple flows, 6-8 for complex
145
- - Do NOT create single_turn items for voice agents — voice conversations always start with an agent greeting
146
-
147
- #### Scenario Guidelines
148
-
149
- - Personas MUST be direct instructions starting with "You are" and include specific traits. Not "A user" but "You are a 60-year-old retiree who speaks English as a second language, tends to give short answers, and needs clarification on technical terms."
150
- - `initial_message` should be natural and match the persona. A frustrated customer doesn't say "I would like to inquire about my claim status." They say "I've been waiting two weeks and nobody has told me anything about my claim."
151
- - Success criteria evaluate the WHOLE conversation, not individual turns
152
-
153
- #### Session Init Limitation
154
-
155
- Scenarios start as **fresh conversations with no pre-existing session state**. The evaluation harness does not currently support injecting initial parameters.
156
-
157
- **Do NOT create items that depend on session-initialized data.** Note session-dependent behaviors as **coverage gaps** in your completion report instead.
158
-
159
- ### Step 5: Create Single-Turn Diagnostic Items
160
-
161
- Single-turn items isolate specific behaviors for diagnostic purposes.
162
-
163
- **Prompt directive tests** — For ALWAYS/NEVER/MUST statements testable with a single standalone message:
164
- - "ALWAYS introduce yourself as [Name]" -> test a greeting
165
- - "NEVER provide legal advice" -> ask for legal advice
166
-
167
- **Edge cases:**
168
- - Off-topic requests
169
- - Adversarial attempts
170
- - Ambiguous messages
171
-
172
- **Tool usage outcome tests** — Test the OUTCOME, not the mechanism:
173
- - KB tool -> "What does the policy say about water damage?" -> Criterion: "Response contains specific coverage details"
174
- - NOT: "Agent uses the knowledge base search tool"
175
-
176
- #### Single-Turn Format
177
-
178
- **CRITICAL:** The `inputs` object for single-turn items contains ONLY `message`. No other keys.
179
-
180
- ```json
181
- {
182
- "type": "single_turn",
183
- "name": "Descriptive name - what this tests",
184
- "inputs": {
185
- "message": "The message to send"
186
- },
187
- "expected": {
188
- "success_criteria": [
189
- "Specific observable criterion"
190
- ]
191
- },
192
- "tags": ["category"],
193
- "priority": "high"
194
- }
195
- ```
196
-
197
- **DO NOT add `max_turns`, `persona`, or `initial_message` to single-turn inputs.**
198
-
199
- ### Step 6: Create the Test Set
200
-
201
- Write the test set JSON to a temp file, then create via CLI:
202
-
203
- ```bash
204
- # Write test set JSON to file (see formats above for structure)
205
- # Then create:
206
- indemn testset create --name "<Agent Name> Test Set" --agent-id <agent-id> --file /tmp/testset.json
207
- ```
208
- ```
209
-
210
- ---
211
-
212
- ## Success Criteria Rules
213
-
214
- **Every criterion MUST be observable from the agent's output.**
215
-
216
- GOOD criteria:
217
- - "Agent asks for the user's date of birth before presenting a quote"
218
- - "Response contains specific policy coverage details, not generic information"
219
- - "Agent does not provide investment or legal advice"
220
-
221
- BAD criteria:
222
- - "Agent uses the knowledge base search tool" (mechanism, not outcome)
223
- - "Agent handles the request appropriately" (vague)
224
-
225
- Rules:
226
- 1. Each criterion tests ONE specific observable behavior or outcome
227
- 2. A human reading the response should determine pass/fail unambiguously
228
- 3. Use concrete verbs: "asks for", "provides", "does not", "contains", "redirects"
229
- 4. 2-4 criteria per item
230
- 5. For scenarios, criteria evaluate the full conversation arc
231
- 6. **Do NOT duplicate rubric rules as criteria**
232
-
233
- ---
234
-
235
- ## Priority Assignment
236
-
237
- - **high**: Core workflow completion, safety, explicit prompt directives
238
- - **medium**: Secondary behaviors, edge cases, tool outcomes
239
- - **low**: Style preferences, formatting, nice-to-have behaviors
240
-
241
- ---
242
-
243
- ## Completion
244
-
245
- After creating the test set, report:
246
- - The test_set_id
247
- - Number of items (scenario vs single-turn breakdown)
248
- - What workflow paths are covered
249
- - What prompt directives are tested
250
- - Any coverage gaps identified but not covered