---
name: loomi-crm-strategy-loop
description: Run the full Loomi/Bloomreach CRM strategy loop from project discovery to segmentation recommendations, feedback-driven refinement, scenario blueprint generation, and node/email content generation. Use when the user asks for an end-to-end CRM flow, project discovery plus segment ideas, tailored scenarios, personalized campaign strategy, lifecycle optimization, retention strategy, or "discover the project and recommend what to build".
---

# Loomi CRM Strategy Loop

Use this skill for the complete agent workflow:

```text
Task routing
  -> local contexts/
  -> supplied projectContextJson
  -> optional Bloomreach CLI cards/raw fallback when available
  -> task packet
  -> project brief
  -> segmentation recommendations
  -> user feedback
  -> refined segmentations
  -> approved segment IDs
  -> scenario blueprint
  -> contentgen API payloads and dynamic email bindings
```

## Tool Responsibilities

- Loomi MCP: source of Bloomreach project truth.
- Local context files: source of business, industry, platform, and lightweight saved project context.
- Supplied projectContextJson: source of current Bloomreach project evidence.
- Optional Bloomreach CLI workspace context: richer card-first project evidence when available.
- Generator tools: structured strategy, scenario, contentgen, measurement, and validation outputs.
- Claude Code/Codex host agent: context loading, conversation, sequencing, feedback loop, and final synthesis.
- User: final judgment and launch decision.

## Workflow

1. Ask only if the missing requirement blocks progress. Otherwise use reasonable defaults.
2. Use `docs/agent-context/router.md` to classify the task family.
3. Read the relevant local context from `contexts/`.
4. Add supplied `projectContextJson` when available.
5. If Bloomreach CLI workspace context exists, read matching cards and selected raw fallback only when useful.
6. Read business or industry context only when it affects the task.
7. Build a task packet with goal, exact IDs, loaded facts, scope, assumptions, and missing context.
8. Call `build_project_brief`.
9. Call `recommend_segmentations`.
10. Present a ranked opportunity matrix and ask for feedback.
11. Call `refine_segmentations` for user feedback.
12. When the user approves segment IDs, call `generate_scenario_from_segments`.
13. Call `generate_node_content` for each content node the user wants.
14. Return the final package with manual Bloomreach implementation steps.

## Output Principles

Every recommendation must explain:

- why this segment
- why this timing
- why this message
- what data supports it
- what could go wrong
- how to measure it

## Guardrails

- Do not create or update Bloomreach assets directly.
- Do not use customer PII unless explicitly required.
- Always name missing data instead of inventing it.
- Always include consent, suppression, frequency, and recent-conversion checks.
- Always separate facts from assumptions.

## Tool Inputs

When using JSON-style tool calls, pass large objects as strings for compatibility:

- `projectContextJson`: stringified selected project evidence from the task packet.
- `projectBriefJson`: stringified project brief or empty string.
- `segmentationSetJson`: stringified segmentation recommendations.
- `selectedSegmentIdsJson`: stringified array of selected segment IDs.
- `scenarioJson`: stringified scenario blueprint.
- `segmentJson`: stringified selected segment.

For unavailable optional fields, pass empty strings. For unavailable project context, pass `"{}"`.
