@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,131 +0,0 @@
1
- ---
2
- name: agent-setup
3
- description: End-to-end agent creation workflow using the indemn CLI — create, configure, and test an Indemn AI agent. Use when the user wants to set up a new agent from scratch.
4
- ---
5
-
6
- # Agent Setup
7
-
8
- Guide the user through creating a fully configured Indemn AI agent using the `indemn` CLI. This skill coordinates across all agent management commands to go from zero to a working, testable agent.
9
-
10
- **Prerequisite:** The `indemn` CLI must be installed and authenticated. Run `indemn whoami` to verify.
11
-
12
- ---
13
-
14
- ## Workflow
15
-
16
- ### Step 1: Gather Requirements
17
-
18
- Ask the user:
19
- 1. **Agent name** — What should this agent be called?
20
- 2. **Purpose** — What does the agent do? (insurance quotes, customer service, FAQ, lead gen, etc.)
21
- 3. **Channels** — Where will it be deployed? (WEB, VOICE, or both)
22
- 4. **Key behaviors** — Any specific rules, tone, or constraints?
23
-
24
- ### Step 2: Create the Agent
25
-
26
- ```bash
27
- indemn agents create --name "<agent name>"
28
- ```
29
-
30
- Capture the agent ID from the output. Report it to the user.
31
-
32
- ### Step 3: Set the System Prompt
33
-
34
- Based on the gathered requirements, draft a system prompt. Include:
35
- - Agent persona (name, role, company)
36
- - Core instructions (what the agent does, how it handles conversations)
37
- - Key constraints (what it should NEVER do)
38
- - Tone guidance
39
-
40
- Present the draft prompt to the user for review before setting it.
41
-
42
- ```bash
43
- indemn config set <agent-id> --prompt "You are..."
44
- ```
45
-
46
- Verify it was set correctly:
47
- ```bash
48
- indemn config get <agent-id> --field prompt
49
- ```
50
-
51
- ### Step 4: Create Functions (if needed)
52
-
53
- If the agent needs to call external APIs or perform actions:
54
-
55
- ```bash
56
- indemn functions create <agent-id> --type rest_api --name "function_name" --description "What this function does"
57
- ```
58
-
59
- ### Step 5: Create Knowledge Base (if needed)
60
-
61
- If the agent needs reference information:
62
-
63
- 1. Create the KB:
64
- ```bash
65
- indemn kb create --name "<KB Name>" --type qna
66
- ```
67
-
68
- 2. Add QA data sources:
69
- ```bash
70
- indemn kb data add <kb-id> --question "What is your coverage?" --answer "We offer auto, home, and life insurance."
71
- ```
72
-
73
- 3. Link the KB to the agent:
74
- ```bash
75
- indemn kb link <agent-id> <kb-id>
76
- ```
77
-
78
- ### Step 6: Test the Agent
79
-
80
- Send test messages to verify the agent responds correctly:
81
- ```bash
82
- indemn chat <agent-id> --message "Hello, I need help with insurance"
83
- ```
84
-
85
- The `--message` flag sends a single message, prints the agent's response, and exits. Run multiple messages to test different scenarios:
86
- ```bash
87
- indemn chat <agent-id> --message "What types of coverage do you offer?"
88
- indemn chat <agent-id> --message "Can you help me file a claim?"
89
- ```
90
-
91
- If the response looks wrong:
92
- - Check the prompt: `indemn config get <agent-id> --field prompt`
93
- - Check agent details: `indemn agents get <agent-id> --json`
94
- - Adjust the prompt: `indemn config set <agent-id> --prompt "..."`
95
- - Re-test with `indemn chat <agent-id> --message "..."`
96
-
97
- ### Step 7: Summary
98
-
99
- Report to the user:
100
- - Agent ID and name
101
- - Configured prompt (brief summary)
102
- - Functions created (if any)
103
- - Knowledge bases linked (if any)
104
- - Test chat result
105
- - Next steps: run evaluations with `/eval-orchestration`, iterate on prompt
106
-
107
- ---
108
-
109
- ## CLI Commands Used
110
-
111
- | Command | Step | Purpose |
112
- |---------|------|---------|
113
- | `indemn agents create` | 2 | Create the agent |
114
- | `indemn config set --prompt` | 3 | Configure system prompt |
115
- | `indemn config get --field prompt` | 3 | Verify prompt |
116
- | `indemn functions create` | 4 | Add API functions |
117
- | `indemn kb create` | 5 | Create knowledge base |
118
- | `indemn kb data add` | 5 | Add QA pairs |
119
- | `indemn kb link` | 5 | Connect KB to agent |
120
- | `indemn chat --message` | 6 | Send test message and get response |
121
- | `indemn agents get` | 6 | Check full agent config |
122
-
123
- ---
124
-
125
- ## Tips
126
-
127
- - Start simple — a good prompt is more important than functions or KBs
128
- - Test after each major change to catch issues early
129
- - Use `/eval-orchestration` after setup to create formal test coverage
130
- - Keep the initial prompt focused — you can iterate after seeing test results
131
- - All list commands support `--json` for machine-readable output
@@ -1,178 +0,0 @@
1
- ---
2
- name: eval-analysis
3
- description: Analyze evaluation results to classify failures as agent issues vs evaluation issues. Also export conversation traces for sharing. Use when the user asks to analyze eval results, understand why tests failed, triage failures, improve evaluation scores, pull conversation traces, or share eval results.
4
- argument-hint: [run-id or agent-id]
5
- allowed-tools: Bash(indemn *)
6
- ---
7
-
8
- # Eval Analysis
9
-
10
- Analyze evaluation run results, classify each failure, and recommend fixes. Also supports exporting conversation traces and generating branded PDF reports.
11
-
12
- **Input:** `$ARGUMENTS` — a run_id (UUID) or agent_id (MongoDB ObjectId)
13
-
14
- ## Step 1: Resolve the Run
15
-
16
- Determine what `$ARGUMENTS` is:
17
- - **UUID format** (contains hyphens, 36 chars) → it's a `run_id`. Use directly.
18
- - **ObjectId format** (24 hex chars) → it's an `agent_id`. Fetch the latest completed run:
19
- ```bash
20
- indemn eval list --agent-id $ARGUMENTS --json --limit 5
21
- ```
22
- Extract the latest `run_id` with `status: completed`.
23
-
24
- If no completed runs exist, tell the user and stop.
25
-
26
- ## Step 2: Pull All Data
27
-
28
- Fetch all data using the CLI (parallelize where possible):
29
-
30
- ```bash
31
- # Run summary
32
- indemn eval status <run-id> --json
33
-
34
- # Per-item results
35
- indemn eval results <run-id> --json
36
-
37
- # Rubric (get rubric_id from run summary)
38
- indemn rubric get <rubric-id> --json
39
-
40
- # Test set (get test_set_id from run summary)
41
- indemn testset get <test-set-id> --json
42
-
43
- # Bot context (get agent_id from run summary)
44
- indemn eval bot-context <agent-id> --json
45
- ```
46
-
47
- For exact response shapes, see `references/data-shapes.md`.
48
-
49
- ## Step 3: Present Run Overview
50
-
51
- Show the user a summary table:
52
-
53
- ```
54
- Run: {run_id}
55
- Agent: {bot_name} ({agent_id})
56
- LLM: {bot_llm_provider}/{bot_llm_model}
57
- Status: {passed}/{total} items passed ({pass_rate}%)
58
-
59
- Criteria: {criteria_passed}/{criteria_total} checks passed
60
- Rubric: {rubric_rules_passed}/{rubric_rules_total} rules passed
61
-
62
- Component Scores:
63
- prompt: {score}% ({passed}/{total})
64
- knowledge_base: {score}% ({passed}/{total})
65
- function: {score}% ({passed}/{total})
66
- general: {score}% ({passed}/{total})
67
- ```
68
-
69
- ## Step 4: Analyze Each Failed Item
70
-
71
- For every result where `passed == false`:
72
-
73
- 1. **Get the test item** — match `test_case_id` to the test set's `items[].item_id` to get the item name, type, inputs, and success_criteria
74
- 2. **Check criteria scores** — from `criteria_scores[]`, list which criteria passed and which failed with their reasoning
75
- 3. **Check rubric scores** — from `rubric_scores[]`, list which rules passed and which failed with their reasoning
76
- 4. **Check for divergence** — flag when criteria say FAIL but rubric says PASS (or vice versa). Divergence is a strong signal of an evaluation problem.
77
- 5. **Read the conversation** — look at `output` field for the full agent response or conversation transcript
78
- 6. **Cross-reference system prompt** — check if the agent's behavior aligns with what the system prompt instructs
79
- 7. **Classify** — assign one of four categories (see below)
80
-
81
- ### Failure Categories
82
-
83
- | Category | Signal | Action |
84
- |----------|--------|--------|
85
- | **Real Agent Problem** | Both criteria and rubric agree agent misbehaved, or output contradicts system prompt | Investigate agent code/prompt |
86
- | **Evaluation Problem** | Criteria ambiguous/too strict, evaluator reasoning shows misunderstanding, agent response was reasonable | Update test set criteria |
87
- | **Test Design Problem** | Test assumptions wrong (e.g., assumed KB lacked info it has), criteria contradict agent's actual capabilities | Redesign test item |
88
- | **KB/Retrieval Problem** | Agent behavior correct but retrieval returned wrong content, or KB is missing needed info | Fix KB content or retrieval config |
89
-
90
- ### Divergence Analysis
91
-
92
- When `criteria_passed != rubric_passed` for an item, this is a first-class finding:
93
- - **Criteria FAIL + Rubric PASS** → criteria are likely too strict or testing the wrong thing
94
- - **Criteria PASS + Rubric FAIL** → rubric may have rules that don't apply to this scenario, or agent violated a behavioral rule despite answering correctly
95
-
96
- Always highlight divergences prominently in the report.
97
-
98
- ## Step 5: Aggregate Findings
99
-
100
- Group all failed items by category:
101
-
102
- ```
103
- ## Findings
104
-
105
- ### Real Agent Problems (N items)
106
- - Item X: [description of what went wrong]
107
-
108
- ### Evaluation Problems (N items)
109
- - Item Y: [why the criteria/rubric is wrong]
110
-
111
- ### Test Design Problems (N items)
112
- - Item Z: [what assumption was incorrect]
113
-
114
- ### KB/Retrieval Problems (N items)
115
- - Item W: [what retrieval issue occurred]
116
- ```
117
-
118
- ## Step 6: Recommendations
119
-
120
- Prioritize fixes:
121
-
122
- - **P1 — Evaluation fixes** (false failures inflate failure count, masking real issues): specific criteria rewrites or rubric rule adjustments
123
- - **P2 — Agent investigation** (real bugs): which code paths or prompt sections to examine
124
- - **P3 — KB/Retrieval fixes**: which knowledge bases need content updates or which retrieval configs need tuning
125
-
126
- For each recommendation, be specific: quote the current criterion/rule, explain what's wrong, and propose the exact replacement text.
127
-
128
- ## Step 7: Offer to Execute Fixes
129
-
130
- Ask the user if they want to apply the evaluation fixes. If yes:
131
-
132
- **Update test set criteria** (creates a new version, non-destructive):
133
- ```bash
134
- # Save the updated test set to a JSON file, then:
135
- indemn testset update <test-set-id> --file updated-testset.json
136
- ```
137
-
138
- **Update rubric rules** (creates a new version, non-destructive):
139
- ```bash
140
- # Save the updated rubric to a JSON file, then:
141
- indemn rubric update <rubric-id> --file updated-rubric.json
142
- ```
143
-
144
- Both update commands create new versions — the previous version is preserved and accessible via `indemn testset versions <id>` / `indemn rubric versions <id>`.
145
-
146
- After applying fixes, suggest re-running the evaluation:
147
- ```bash
148
- indemn eval run <agent-id> --test-set <test-set-id> --rubric <rubric-id> --wait
149
- ```
150
-
151
- ## Export: Conversation Traces
152
-
153
- When the user wants to **share results** or **export conversation traces** (rather than triage failures):
154
-
155
- ### Markdown Export
156
- ```bash
157
- indemn eval export <run-id>
158
- # Optional: specify output path
159
- indemn eval export <run-id> --output results.md
160
- ```
161
-
162
- Produces a structured markdown file with all conversations, criteria scores, and rubric scores.
163
-
164
- ### PDF Report
165
- ```bash
166
- indemn eval report <run-id>
167
- # Optional: specify output path
168
- indemn eval report <run-id> --output report.pdf
169
- ```
170
-
171
- Produces a branded Indemn PDF with cover page, dual scores (criteria + rubric), and per-item detail pages.
172
-
173
- ### Agent Card
174
- ```bash
175
- indemn agents card <agent-id>
176
- ```
177
-
178
- Produces a multi-page branded PDF with system prompt, tools, KBs, LLM config, evaluation history, and metadata.
@@ -1,257 +0,0 @@
1
- ---
2
- name: eval-orchestration
3
- description: Evaluation workflow using the indemn CLI — create rubrics, test sets, run evaluations, and analyze results. Use for any evaluation task on Indemn agents.
4
- ---
5
-
6
- # Evaluation Orchestration
7
-
8
- You guide evaluation workflows for AI agents using the `indemn` CLI. This skill covers the full lifecycle: creating evaluation materials, running evaluations, and analyzing results.
9
-
10
- **Prerequisite:** The `indemn` CLI must be installed and authenticated. Run `indemn whoami` to verify.
11
-
12
- ---
13
-
14
- ## Mode Detection
15
-
16
- Check the FIRST LINE of the user's message:
17
-
18
- **HEADLESS** — Execute autonomously without asking questions. Optimize for completion.
19
-
20
- **INTERACTIVE** — Get explicit approval before every action that creates, modifies, or triggers anything.
21
-
22
- ### Interactive Mode Approval Gates
23
-
24
- 1. Before creating anything → describe what you plan to do, ask "Should I proceed?"
25
- 2. After creation → summarize what was created, ask "Want to review or should I continue?"
26
- 3. Before triggering an evaluation → confirm test set + rubric selection, ask "Ready to run?"
27
- 4. Before modifying anything → explain the change, ask "OK to update?"
28
-
29
- ---
30
-
31
- ## Evaluation Harness Overview
32
-
33
- The harness tests conversational AI agents against quality standards:
34
-
35
- 1. **Sends test items** to the agent (single-turn messages or multi-turn scenarios)
36
- 2. **Collects responses** (single response or full conversation transcript)
37
- 3. **Scores responses** against per-item success criteria and universal rubric rules
38
- 4. **Reports results** with pass/fail rates and detailed feedback
39
-
40
- ### Two Evaluation Layers
41
-
42
- | Layer | Source | Applies To | Purpose |
43
- |-------|--------|------------|---------|
44
- | **Success Criteria** | Embedded in each test item | That specific item | Did the agent handle THIS situation correctly? |
45
- | **Rubric Rules** | Separate rubric document | ALL items universally | Does the agent meet baseline behavioral standards? |
46
-
47
- ### Three Test Types
48
-
49
- | Type | Input | What It Tests |
50
- |------|-------|---------------|
51
- | **single_turn** | A single message | Specific directive compliance, edge cases |
52
- | **scenario** | Persona + initial message + max turns | End-to-end workflow completion (chat agents) |
53
- | **voice_simulation** | Persona + initial message + max turns (via LiveKit) | End-to-end voice workflow |
54
-
55
- ---
56
-
57
- ## The Directive Allocation Workflow
58
-
59
- **This is the core innovation. Follow this BEFORE creating rubric or test set.**
60
-
61
- ### Step 1: Fetch Bot Context
62
-
63
- ```bash
64
- indemn eval bot-context <agent-id> --json
65
- ```
66
-
67
- Extract the system prompt, tools, and knowledge bases.
68
-
69
- ### Step 2: Parse All Directives
70
-
71
- Identify every ALWAYS/NEVER/MUST/CRITICAL directive from the system prompt. List them all.
72
-
73
- ### Step 3: Apply the 3-Message Universal Applicability Test
74
-
75
- For EACH directive, mentally test it against these three messages:
76
-
77
- 1. **Greeting:** "Hello, I'm interested in wedding insurance"
78
- 2. **Off-topic:** "Can you help me with my taxes?"
79
- 3. **Utility:** "I need to correct my phone number"
80
-
81
- Ask: "Would I check this directive against ALL THREE of these messages?"
82
-
83
- ### Step 4: Classify Each Directive
84
-
85
- | Classification | Rule | Where It Goes |
86
- |---------------|------|---------------|
87
- | **UNIVERSAL** | Passes the 3-message test | Rubric rule |
88
- | **WORKFLOW-SPECIFIC** | Only applies in certain situations | Test set scenario success criteria |
89
- | **AMBIGUOUS** | Unclear whether universal | Default to scenario criteria |
90
-
91
- ### Step 5: Produce Allocation Table
92
-
93
- ```
94
- | Directive | Classification | Destination |
95
- |-----------|---------------|-------------|
96
- | "ALWAYS maintain professional tone" | UNIVERSAL | Rubric rule |
97
- | "MUST collect DOB before quoting" | WORKFLOW-SPECIFIC | Scenario criteria |
98
- | "NEVER provide medical advice" | UNIVERSAL | Rubric rule |
99
- ```
100
-
101
- ### Step 6: Create Artifacts Using the Allocation
102
-
103
- - Read the `rubric-creation` skill and create the rubric using ONLY universal directives
104
- - Read the `test-set-creation` skill and create the test set, mapping workflow-specific directives as scenario success criteria
105
-
106
- ---
107
-
108
- ## Workflows
109
-
110
- ### Workflow A: New Evaluation
111
-
112
- 1. **Gather intent** — Which agent? Any focus areas?
113
- 2. **Fetch bot context:**
114
- ```bash
115
- indemn eval bot-context <agent-id> --json
116
- ```
117
- 3. **Run directive allocation** — Follow the workflow above
118
- 4. **Create rubric** — Write rubric JSON to a temp file, then:
119
- ```bash
120
- indemn rubric create --name "<name>" --agent-id <agent-id> --file /tmp/rubric.json
121
- ```
122
- 5. **Create test set** — Write test set JSON to a temp file, then:
123
- ```bash
124
- indemn testset create --name "<name>" --agent-id <agent-id> --file /tmp/testset.json
125
- ```
126
- 6. **Review** — Summarize what was created (interactive: wait for approval)
127
- 7. **Trigger evaluation:**
128
- ```bash
129
- indemn eval run <agent-id> --test-set <test-set-id> --rubric <rubric-id> --wait
130
- ```
131
- The `--wait` flag polls until completion and shows results.
132
- **CRITICAL:** For voice_simulation items, add `--concurrency 1`.
133
- 8. **Analyze results:**
134
- ```bash
135
- indemn eval results <run-id> --json
136
- ```
137
-
138
- ### Workflow B: Browse Existing Resources
139
-
140
- ```bash
141
- indemn rubric list [--agent-id <id>]
142
- indemn testset list [--agent-id <id>]
143
- indemn eval status <run-id>
144
- ```
145
-
146
- ### Workflow C: Update Existing Resources
147
-
148
- 1. Get the existing resource:
149
- ```bash
150
- indemn rubric get <id> --json
151
- indemn testset get <id> --json
152
- ```
153
- 2. Write updated JSON to a file
154
- 3. Send the update:
155
- ```bash
156
- indemn rubric update <id> --file /tmp/rubric-updated.json
157
- indemn testset update <id> --file /tmp/testset-updated.json
158
- ```
159
-
160
- ### Workflow D: Re-run with Existing Resources
161
-
162
- 1. List existing resources: `indemn rubric list`, `indemn testset list`
163
- 2. Trigger evaluation:
164
- ```bash
165
- indemn eval run <agent-id> --test-set <id> --rubric <id> --wait
166
- ```
167
-
168
- ### Workflow E: Analyze Results
169
-
170
- ```bash
171
- indemn eval results <run-id> --json
172
- ```
173
-
174
- Analyze patterns:
175
- - **By test item**: Which items failed? Check criteria_scores and rubric_scores
176
- - **By criteria**: Patterns in which criteria fail across items
177
- - **By rubric rule**: Which universal rules have lowest pass rates?
178
- - **By test type**: Do scenarios fail more than single-turn?
179
-
180
- Suggest improvements: system prompt changes, tool configuration, KB updates.
181
-
182
- ---
183
-
184
- ## CLI Commands Used
185
-
186
- | Command | Purpose |
187
- |---------|---------|
188
- | `indemn eval bot-context <id>` | Get bot configuration (prompt, tools, KBs) |
189
- | `indemn config get <id> --field prompt` | Get just the system prompt |
190
- | `indemn functions list <id>` | List agent's functions |
191
- | `indemn rubric create --file` | Create a rubric from JSON |
192
- | `indemn rubric get <id>` | Get rubric details |
193
- | `indemn rubric list` | List rubrics |
194
- | `indemn rubric update <id> --file` | Update a rubric |
195
- | `indemn rubric delete <id>` | Delete a rubric |
196
- | `indemn testset create --file` | Create a test set from JSON |
197
- | `indemn testset get <id>` | Get test set details |
198
- | `indemn testset list` | List test sets |
199
- | `indemn testset update <id> --file` | Update a test set |
200
- | `indemn testset delete <id>` | Delete a test set |
201
- | `indemn eval run <id> --test-set --rubric` | Trigger an evaluation |
202
- | `indemn eval status <run-id>` | Get run status |
203
- | `indemn eval results <run-id>` | Get detailed results |
204
-
205
- ---
206
-
207
- ## Rubric JSON Format
208
-
209
- ```json
210
- {
211
- "rules": [
212
- {
213
- "id": "snake_case_id",
214
- "name": "Human Readable Name",
215
- "severity": "high|medium|low",
216
- "category": "accuracy|persona|instruction_compliance|safety|response_quality",
217
- "description": "What this rule checks and why",
218
- "evaluation_criteria": {
219
- "pass_conditions": ["Observable behavior that passes"],
220
- "fail_conditions": ["Observable behavior that fails"]
221
- }
222
- }
223
- ]
224
- }
225
- ```
226
-
227
- ## Test Set JSON Format
228
-
229
- ```json
230
- {
231
- "items": [
232
- {
233
- "type": "single_turn",
234
- "name": "Test name",
235
- "inputs": { "message": "User message" },
236
- "expected": { "success_criteria": ["Criterion 1", "Criterion 2"] },
237
- "tags": ["category"],
238
- "priority": "high|medium|low"
239
- },
240
- {
241
- "type": "scenario",
242
- "name": "Scenario name",
243
- "inputs": {
244
- "persona": "You are a [type] who [traits].",
245
- "initial_message": "Natural first message",
246
- "max_turns": 5
247
- },
248
- "expected": {
249
- "success_criteria": ["Criterion 1"],
250
- "expected_outcome": "What the conversation should achieve"
251
- },
252
- "tags": ["scenario"],
253
- "priority": "high"
254
- }
255
- ]
256
- }
257
- ```