Module: Insika::Harvest
- Defined in:
- lib/insika/harvest.rb,
lib/insika/harvest/gate.rb,
lib/insika/harvest/criterion.rb,
lib/insika/harvest/negative_list.rb,
lib/insika/harvest/conversion_gate.rb
Overview
the one place harvest asks a model for anything.
The engine's generic prompt (what a harvestable skill is, the answer
shape, the provenance + grounding rules — "only reference IDs you saw in
the evidence; never invent a product"). A pack harvest.prompt REPLACES
this wholesale (the forge's half).
Defined Under Namespace
Modules: MinerFactory Classes: ConversionGate, Criterion, Gate, Miner, NegativeList
Constant Summary collapse
- DEFAULT_PROMPT =
<<~PROMPT.freeze You are mining SKILLS from finished customer-service conversations of ONE store agent, for a playbook the agent loads on demand. A skill is a reusable procedure: WHEN to load it and the exact steps to follow. It is NOT a fact about one customer, and NOT a rewrite of the agent's instructions. Answer with a single JSON array and NOTHING else. No prose, no fences. Each element is an object with: - "name" — the skill's key, short (max 64 chars), lowercase, underscore-separated; - "description" — one line (max 300 chars): what the skill is for; - "body" — the SKILL.md body (max 6000 chars): the procedure itself; - "triggers" — optional, up to 10 short words or phrases that should surface this skill; - "rationale" — optional, one line: what problem the skill solves; - "evidence_turns" — optional, the message indexes in the conversations that support it. Rules: - Reference products by their ID only — an ID you saw in the evidence. Never invent a SKU or a product name; the engine rejects anything it cannot verify (grounding). - Never include a session id, a customer id or a tenant — the engine stamps the origin itself. - A skill every good agent already does is not a skill worth proposing. - Fewer, better skills beat filling a quota. PROMPT
- SKILL_SCHEMA =
The safe-subset JSON Schema (array of objects — Workflow::Schema's subset, the house zero-dep validator). The miner rejects any key OUTSIDE this set and counts the drop: a model-authored
origin/agentwould be a provenance lie — the schema refuses it by not having the key, and the engine stamps origin itself. Insika::Workflow::Schema.coerce({ "type" => "array", "items" => { "type" => "object", "properties" => { "name" => { "type" => "string" }, "description" => { "type" => "string" }, "body" => { "type" => "string" }, "triggers" => { "type" => "array", "items" => { "type" => "string" } }, "rationale" => { "type" => "string" }, "evidence_turns" => { "type" => "array", "items" => { "type" => "integer" } } }, "required" => %w[name description body] } })
- ITEM_SCHEMA =
The per-SKILL half (an item of SKILL_SCHEMA) — validated per element.
Insika::Workflow::Schema.coerce(SKILL_SCHEMA.json_schema["items"])