Skill: jose-compu/self-improving-sales (version 1.1.0)

--- name: self-improving-sales description: "Captures pipeline leaks, objection patterns, pricing errors, forecast misses, competitor shifts, and deal velocity drops to enable continuous sales improvement. Use when: (1) A deal slips past stage thresholds, (2) An objection recurs across multiple deals, (3) A pricing mistake is discovered, (4) Forecast accuracy falls below target, (5) A deal is lost to a competitor, (6) Discount escalations exceed policy, (7) A win/loss pattern emerges." --- # Self-Improving Sales Skill Log sales-specific learnings, deal issues, and feature requests to markdown files for continuous improvement. Captures pipeline leaks, objection patterns, pricing errors, forecast misses, competitor shifts, and deal velocity drops. Important learnings get promoted to battle cards, objection handling scripts, pricing playbooks, or qualification frameworks (MEDDIC/BANT). ## First-Use Initialisation Before logging anything, ensure the `.learnings/` directory and files exist in the project or workspace root. If any are missing, create them: ```bash mkdir -p .learnings [ -f .learnings/LEARNINGS.md ] || printf "# Sales Learnings\n\nObjection patterns, competitor intelligence, pipeline insights, qualification gaps, and deal execution lessons captured during sales operations.\n\n**Categories**: pipeline_leak | objection_pattern | pricing_error | forecast_miss | competitor_shift | deal_velocity_drop\n**Areas**: prospecting | qualification | discovery | proposal | negotiation | closing | renewal\n\n---\n" > .learnings/LEARNINGS.md [ -f .learnings/DEAL_ISSUES.md ] || printf "# Deal Issues Log\n\nLost deals, pipeline leaks, pricing errors, forecast misses, and deal execution failures.\n\n---\n" > .learnings/DEAL_ISSUES.md [ -f .learnings/FEATURE_REQUESTS.md ] || printf "# Feature Requests\n\nSales tools, CRM automation, competitive intelligence, and pipeline management capabilities requested during sales operations.\n\n---\n" > .learnings/FEATURE_REQUESTS.md ``` Never overwrite existing files. This is a no-op if `.learnings/` is already initialised. Do not log customer PII, exact contract values, or confidential deal terms. Use deal size ranges (e.g., "$100K-$250K") and anonymize company names when sharing externally. If you want automatic reminders, use the opt-in hook workflow described in [Hook Integration](#hook-integration). ## Quick Reference | Situation | Action | |-----------|--------| | Deal stuck in same stage >30 days | Log to `.learnings/DEAL_ISSUES.md` with pipeline_leak category | | Objection you couldn't handle | Log to `.learnings/LEARNINGS.md` with category `objection_pattern` | | Pricing mistake discovered | Log to `.learnings/DEAL_ISSUES.md` with pricing_error category | | Forecast missed by >20% | Log to `.learnings/DEAL_ISSUES.md` with forecast_miss category | | Lost deal to competitor | Log to `.learnings/LEARNINGS.md` with category `competitor_shift` | | Discount over threshold requested | Log to `.learnings/DEAL_ISSUES.md` with pricing_error category | | Recurring objection across deals | Link with `**See Also**`, consider priority bump | | Broadly applicable insight | Promote to battle card, objection handler, or pricing playbook | | Qualification gap identified | Promote to MEDDIC/BANT framework update | ## OpenClaw Setup (Recommended) OpenClaw is the primary platform for this skill. It uses workspace-based prompt injection with automatic skill loading. ### Installation **Via ClawdHub (recommended):** ```bash clawdhub install self-improving-sales ``` **Manual:** ```bash git clone https://github.com/jose-compu/self-improving-sales.git ~/.openclaw/skills/self-improving-sales ``` ### Workspace Structure OpenClaw injects these files into every session: ``` ~/.openclaw/workspace/ ├── AGENTS.md # Multi-agent workflows, delegation patterns ├── SOUL.md # Behavioral guidelines, personality, principles ├── TOOLS.md # Tool capabilities, integration gotchas ├── MEMORY.md # Long-term memory (main session only) ├── memory/ # Daily memory files │ └── YYYY-MM-DD.md └── .learnings/ # This skill's log files ├── LEARNINGS.md ├── DEAL_ISSUES.md └── FEATURE_REQUESTS.md ``` ### Create Learning Files ```bash mkdir -p ~/.openclaw/workspace/.learnings ``` Then create the log files (or copy from `assets/`): - `LEARNINGS.md` — objection patterns, competitor intelligence, pipeline insights, deal velocity - `DEAL_ISSUES.md` — pipeline leaks, lost deals, pricing errors, forecast misses - `FEATURE_REQUESTS.md` — CRM automation, competitive intelligence tools, pipeline analytics ### Promotion Targets When sales learnings prove broadly applicable, promote them: | Learning Type | Promote To | Example | |---------------|------------|---------| | Objection patterns | Objection handling scripts | "When prospect says 'too expensive', reframe to ROI" | | Competitor intelligence | Battle cards | "Competitor X launched free tier — counter with migration cost" | | Qualification gaps | MEDDIC/BANT frameworks | "Always identify economic buyer before demo" | | Pricing patterns | Pricing playbooks | "Never discount >15% without VP approval and multi-year commit" | | Win/loss patterns | Deal review templates | "Deals without champion identified by Stage 3 close at 12%" | | Process improvements | `AGENTS.md` | "Update CRM within 24 hours of every meeting" | ### Optional: Enable Hook For automatic reminders at session start: ```bash cp -r hooks/openclaw ~/.openclaw/hooks/self-improving-sales openclaw hooks enable self-improving-sales ``` See `references/openclaw-integration.md` for complete details. --- ## Generic Setup (Other Agents) For Claude Code, Codex, Copilot, or other agents, create `.learnings/` in the project or workspace root: ```bash mkdir -p .learnings ``` Create the files inline using the headers shown above. ### Add reference to agent files Add to `AGENTS.md`, `CLAUDE.md`, or `.github/copilot-instructions.md`: #### Self-Improving Sales Workflow When sales issues or patterns are discovered: 1. Log to `.learnings/DEAL_ISSUES.md`, `LEARNINGS.md`, or `FEATURE_REQUESTS.md` 2. Review and promote broadly applicable learnings to: - Battle cards — competitive positioning and differentiation - Objection handling scripts — proven responses to common objections - Pricing playbooks — discount policies, packaging, and negotiation guardrails - Qualification frameworks — MEDDIC/BANT checklists and stage gate criteria ## Logging Format ### Learning Entry [LRN-YYYYMMDD-XXX] Append to `.learnings/LEARNINGS.md`: ```markdown ## [LRN-YYYYMMDD-XXX] category **Logged**: ISO-8601 timestamp **Priority**: low | medium | high | critical **Status**: pending **Area**: prospecting | qualification | discovery | proposal | negotiation | closing | renewal ### Summary One-line description of the sales insight ### Details Full context: what happened in the deal, why the outcome occurred, what the correct approach or response is. Include specific objection language, competitor positioning, or deal dynamics. ### Deal Context **Objection / Situation:** > Exact quote or paraphrase of the objection, competitor claim, or deal blocker **Response Used:** > What was said or done in response **Outcome:** Won | Lost | Stalled | Pushed — and why ### Suggested Action Specific change to pitch, process, pricing, or qualification criteria ### Metadata - Source: call_transcript | deal_review | win_loss_analysis | pipeline_review | competitor_intel | forecast_review - Deal Size: $50K-$100K | $100K-$250K | $250K-$500K | $500K+ (use ranges) - Segment: SMB | mid_market | enterprise | strategic - Industry: technology | financial_services | healthcare | manufacturing | retail | other - Related Deals: DEAL-YYYYMMDD-XXX (if linked to a deal issue) - Tags: tag1, tag2 - See Also: LRN-20250410-001 (if related to existing entry) - Pattern-Key: objection.budget_freeze | competitor.free_tier (optional) - Recurrence-Count: 1 (optional) - First-Seen: 2025-01-15 (optional) - Last-Seen: 2025-01-15 (optional) --- ``` **Categories for learnings:** | Category | Use When | |----------|----------| | `pipeline_leak` | Deals consistently falling out at a specific stage | | `objection_pattern` | Same objection surfacing across multiple deals | | `pricing_error` | Quoting wrong price, unapproved discount, packaging mistake | | `forecast_miss` | Predicted close date or amount significantly off actual | | `competitor_shift` | Competitor launches feature, changes pricing, or wins pattern | | `deal_velocity_drop` | Deals taking longer than historical average to progress | ### Deal Issue Entry [DEAL-YYYYMMDD-XXX] Append to `.learnings/DEAL_ISSUES.md`: ```markdown ## [DEAL-YYYYMMDD-XXX] issue_type **Logged**: ISO-8601 timestamp **Priority**: high **Status**: pending **Area**: prospecting | qualification | discovery | proposal | negotiation | closing | renewal ### Summary Brief description of the deal issue ### Deal Details - **Stage**: Stage where the issue occurred - **Deal Size**: $100K-$250K (use ranges) - **Days in Stage**: Number of days stuck or time to loss - **Segment**: SMB | mid_market | enterprise | strategic ### What Happened Narrative of what went wrong: missed signals, process breakdown, competitive loss, pricing confusion, or forecast error. ### Root Cause Why the deal was lost, stalled, or mispriced. Distinguish symptom from cause. ### Impact - Revenue impact (range) - Pipeline coverage impact - Forecast accuracy impact ### Prevention How to avoid this issue in future deals: qualification criteria, process gate, pricing checklist, competitive preparation ### Metadata - Trigger: pipeline_review | deal_review | win_loss_analysis | forecast_review | CRM_audit - Competitor: competitor name (if applicable) - Loss Reason: no_budget | no_decision | lost_to_competitor | timing | product_gap | price - Related Files: path/to/deal_review.md - See Also: DEAL-20250110-001 (if recurring pattern) --- ``` ### Feature Request Entry [FEAT-YYYYMMDD-XXX] Append to `.learnings/FEATURE_REQUESTS.md`: ```markdown ## [FEAT-YYYYMMDD-XXX] capability_name **Logged**: ISO-8601 timestamp **Priority**: medium **Status**: pending **Area**: prospecting | qualification | discovery | proposal | negotiation | closing | renewal ### Requested Capability What sales tool, automation, or capability is needed ### User Context Why it's needed, what workflow it improves, what revenue impact it could have ### Complexity Estimate simple | medium | complex ### Suggested Implementation How this could be built: CRM workflow, Slack integration, dashboard, alert system ### Metadata - Frequency: first_time | recurring - Related Features: existing_tool_or_feature --- ``` ## ID Generation Format: `TYPE-YYYYMMDD-XXX` - TYPE: `LRN` (learning), `DEAL` (deal issue), `FEAT` (feature request) - YYYYMMDD: Current date - XXX: Sequential number or random 3 chars (e.g., `001`, `A7B`) Examples: `LRN-20250415-001`, `DEAL-20250415-A3F`, `FEAT-20250415-002` ## Resolving Entries When an issue is addressed, update the entry: 1. Change `**Status**: pending` → `**Status**: resolved` 2. Add resolution block after Metadata: ```markdown ### Resolution - **Resolved**: 2025-01-16T09:00:00Z - **Action Taken**: Updated battle card / revised pricing playbook / added qualification gate - **Notes**: Rolled out to team in weekly sales meeting, updated CRM stage criteria ``` Other status values: - `in_progress` — Actively being addressed or tested in live deals - `wont_fix` — Decided not to address (add reason in Resolution notes) - `promoted` — Elevated to battle card, objection script, or pricing playbook - `promoted_to_skill` — Extracted as a reusable skill ## Detection Triggers Automatically log when you encounter: **Pipeline Stalls** (→ deal issue with pipeline_leak): - Deal in same stage for >30 days - Multiple deals stalling at the same stage - Conversion rate drop between stages - Deals pushed from one quarter to next **Objection Patterns** (→ learning with objection_pattern): - Same objection heard in 3+ deals within a quarter - Objection that consistently leads to no-decision outcomes - New objection not covered by existing battle cards - Objection specific to a segment or industry vertical **Pricing Issues** (→ deal issue with pricing_error): - Discount >20% requested by prospect - Quoting a deprecated or incorrect pricing tier - Competitor undercut by >30% on similar deal - Custom pricing requested outside standard packaging **Forecast Misses** (→ deal issue with forecast_miss): - Quarterly forecast accuracy below 80% - Deal close date pushed more than twice - Commit deal lost or pushed to next quarter - Upside deal that was actually a commit **Competitive Intelligence** (→ learning with competitor_shift): - Competitor mentioned in 3+ call transcripts in a month - Competitor launches new product, feature, or pricing tier - Prospect received competitive quote or evaluation - Win rate drops against specific competitor **Deal Velocity** (→ learning with deal_velocity_drop): - Average deal cycle lengthening quarter over quarter - Specific stage taking 2x historical average - Deals requiring more meetings to close - Longer legal/procurement review cycles ## Priority Guidelines | Priority | When to Use | Sales Examples | |----------|-------------|----------------| | `critical` | Deal >$500K at risk, data integrity issue, compliance violation | Enterprise deal at risk of loss, CRM data corruption, contract pricing error affecting multiple deals | | `high` | Recurring objection pattern, forecast miss >20%, competitive threat | Same objection losing 3+ deals, quarterly forecast off by 25%, competitor winning all deals in a segment | | `medium` | Pipeline hygiene, process improvement, single deal coaching | Deals not advancing past discovery, reps not updating CRM, proposal template outdated | | `low` | Documentation, minor CRM fix, process tweak | Field label change, report format update, email template refresh | ## Area Tags Use to filter learnings by sales stage: | Area | Scope | |------|-------| | `prospecting` | Lead generation, outbound sequences, ICP targeting, SDR handoff | | `qualification` | MEDDIC/BANT scoring, stage gate criteria, champion identification | | `discovery` | Pain identification, business case building, stakeholder mapping | | `proposal` | Pricing, packaging, SOW creation, legal review, procurement | | `negotiation` | Discount requests, contract terms, multi-year commits, procurement | | `closing` | Final approval, signature, procurement, legal, security review | | `renewal` | Expansion, upsell, churn prevention, customer success handoff | ## Promoting to Permanent Sales Assets When a learning is broadly applicable (not a one-off deal quirk), promote it to permanent team assets. ### When to Promote - Objection recurs across 3+ deals in a quarter - Competitive intelligence applies to an entire segment - Pricing insight affects multiple deal sizes or verticals - Qualification gap leads to predictable deal failures - Win/loss pattern is statistically significant (10+ deals) ### Promotion Targets | Target | What Belongs There | |--------|-------------------| | Battle cards | Competitive positioning, differentiation, trap-setting questions | | Objection handling scripts | Proven responses with context, follow-up questions, proof points | | Pricing playbooks | Discount guardrails, packaging options, negotiation tactics | | MEDDIC/BANT frameworks | Qualification checklists, stage gate criteria, champion tests | | Deal review templates | Win/loss analysis structure, pipeline review agendas | | `AGENTS.md` | Automated CRM workflows, deal scoring rules | ### How to Promote 1. **Distill** the learning into a concise, actionable asset 2. **Add** to appropriate target (battle card entry, objection script, playbook rule) 3. **Update** original entry: - Change `**Status**: pending` → `**Status**: promoted` - Add `**Promoted**: battle card` (or `objection script`, `pricing playbook`, `MEDDIC framework`) ### Promotion Examples **Learning** (verbose): > Prospect said "We already have a vendor for this." We had no differentiation > message ready. Lost the deal because we couldn't articulate unique value vs. > incumbent. This happened in 4 deals this quarter against Vendor X. **As battle card** (concise): ```markdown ## Objection: "We already have a vendor" **Response Framework:** 1. Acknowledge: "That makes sense — most companies in your space do." 2. Probe: "How well is it handling [specific pain point]?" 3. Differentiate: "Where we're different is [unique capability] which means [business outcome]." 4. Proof: "Company Y switched from [vendor] and saw [metric improvement]." **Trap-Setting Questions:** - "How much time does your team spend on [task our product automates]?" - "What happens when [scenario our product handles better]?" ``` **Learning** (verbose): > Deals without an identified champion by Stage 3 close at only 12% vs. 48% > for deals with a champion. We need a hard gate requiring champion > identification before advancing to proposal. **As MEDDIC framework update** (actionable): ```markdown ## Stage Gate: Discovery → Proposal **Required before advancing:** - [ ] Champion identified (name, title, access level) - [ ] Champion has confirmed the problem exists - [ ] Champion has agreed to introduce economic buyer - [ ] Decision criteria documented from champion conversation **Block advancement if:** No champion identified after 3 discovery calls. Recommend: Re-qualify or move to nurture. ``` ## Recurring Pattern Detection If logging something similar to an existing entry: 1. **Search first**: `grep -r "keyword" .learnings/` 2. **Link entries**: Add `**See Also**: DEAL-20250110-001` in Metadata 3. **Bump priority** if issue keeps recurring 4. **Consider systemic fix**: Recurring sales issues often indicate: - Missing qualification criteria (→ update MEDDIC/BANT framework) - Competitive gap (→ create or update battle card) - Pricing misalignment (→ revise pricing playbook) - Process breakdown (→ add CRM stage gate or automation) ## Periodic Review Review `.learnings/` at natural breakpoints: ### When to Review - Before starting a new deal in the same segment or against the same competitor - After completing quarterly business review (QBR) - When the same objection or loss reason appears again - Weekly during pipeline review meetings - After each win/loss analysis ### Quick Status Check ```bash # Count pending sales issues grep -h "Status\*\*: pending" .learnings/*.md | wc -l # List pending high-priority deal issues grep -B5 "Priority\*\*: high" .learnings/DEAL_ISSUES.md | grep "^## \[" # Find learnings for a specific sales stage grep -l "Area\*\*: negotiation" .learnings/*.md # Find all competitor-related learnings grep -B2 "competitor_shift" .learnings/LEARNINGS.md | grep "^## \[" # List objection patterns grep -B2 "objection_pattern" .learnings/LEARNINGS.md | grep "^## \[" ``` ### Review Actions - Resolve addressed deal issues - Promote recurring objections to battle cards - Link related entries across files - Extract reusable qualification criteria as framework updates - Update forecast model based on historical miss patterns ## Simplify & Harden Feed Ingest recurring sales patterns from `simplify-and-harden` into playbooks or frameworks. 1. For each candidate, use `pattern_key` as the dedupe key. 2. Search `.learnings/LEARNINGS.md` for existing entry: `grep -n "Pattern-Key: <key>" .learnings/LEARNINGS.md` 3. If found: increment `Recurrence-Count`, update `Last-Seen`, add `See Also` links. 4. If not found: create new `LRN-...` entry with `Source: simplify-and-harden`. **Promotion threshold**: `Recurrence-Count >= 3`, seen in 2+ deals or segments, within 90-day window. Targets: battle cards, objection scripts, pricing playbooks, MEDDIC/BANT frameworks, `AGENTS.md`. ## Hook Integration Enable automatic reminders through agent hooks. This is **opt-in**. ### Quick Setup (Claude Code / Codex) Create `.claude/settings.json` in your project: ```json { "hooks": { "UserPromptSubmit": [{"matcher": "", "hooks": [{"type": "command", "command": "./skills/self-improving-sales/scripts/activator.sh"}]}], "PostToolUse": [{"matcher": "Bash", "hooks": [{"type": "command", "command": "./skills/self-improving-sales/scripts/error-detector.sh"}]}] } } ``` The `UserPromptSubmit` hook injects a sales-focused reminder (~50-100 tokens). The `PostToolUse` hook detects deal-related signals (lost deals, churn, competitor mentions, forecast misses). Use only `UserPromptSubmit` for lower overhead. ### Available Hook Scripts | Script | Hook Type | Purpose | |--------|-----------|---------| | `scripts/activator.sh` | UserPromptSubmit | Reminds to evaluate sales learnings after tasks | | `scripts/error-detector.sh` | PostToolUse (Bash) | Triggers on deal issues, competitor mentions, pipeline signals | See `references/hooks-setup.md` for detailed configuration and troubleshooting. ## Automatic Skill Extraction When a sales learning is valuable enough to become a reusable skill, extract it. ### Skill Extraction Criteria | Criterion | Description | |-----------|-------------| | **Recurring** | Same objection or deal pattern in 3+ deals or segments | | **Verified** | Status is `resolved` with proven response or process fix | | **Non-obvious** | Required actual deal experience or loss to discover | | **Broadly applicable** | Not deal-specific; useful across segments or verticals | | **User-flagged** | User says "save this as a skill" or similar | ### Extraction Workflow 1. **Identify candidate**: Learning meets extraction criteria 2. **Run helper** (or create manually): ```bash ./skills/self-improving-sales/scripts/extract-skill.sh skill-name --dry-run ./skills/self-improving-sales/scripts/extract-skill.sh skill-name ``` 3. **Customize SKILL.md**: Fill in template with sales-specific content 4. **Update learning**: Set status to `promoted_to_skill`, add `Skill-Path` 5. **Verify**: Read skill in fresh session to ensure it's self-contained ### Extraction Detection Triggers **In conversation**: "This objection keeps coming up", "Save this competitive intel as a skill", "I keep losing deals at this stage", "Every enterprise deal has this procurement issue". **In entries**: Multiple `See Also` links, high priority + resolved, `objection_pattern` or `competitor_shift` with broad applicability, same `Pattern-Key` across deals or segments. ## Sales-Specific Best Practices 1. **Qualify early** — disqualify faster to focus pipeline on winnable deals 2. **Document objections immediately** — exact wording matters for battle cards 3. **Update CRM same day** — stale data poisons forecasts and pipeline reviews 4. **Track competitor intel in real time** — pricing changes and feature launches decay fast 5. **Review win/loss quarterly** — patterns only emerge with enough data points 6. **Log the objection, not just the outcome** — "we lost" is less useful than "they said X" 7. **Anonymize appropriately** — use deal size ranges and avoid customer PII in shared logs 8. **Distinguish decision-maker objections from user objections** — different responses required 9. **Record what you tried** — failed responses are as valuable as successful ones 10. **Promote aggressively** — if an objection appears in 3 deals, it deserves a battle card ## Multi-Agent Support | Agent | Activation | Detection | |-------|-----------|-----------| | Claude Code | Hooks (UserPromptSubmit, PostToolUse) | Automatic via error-detector.sh | | Codex CLI | Hooks (same pattern) | Automatic via hook scripts | | GitHub Copilot | Manual (`.github/copilot-instructions.md`) | Manual review | | OpenClaw | Workspace injection + inter-agent messaging | Via session tools | ## Gitignore Options **Keep learnings local** (per-rep): ```gitignore .learnings/ ``` **Track learnings in repo** (team-wide): Don't add to .gitignore — learnings become shared team knowledge. **Hybrid** (track templates, ignore entries): ```gitignore .learnings/*.md !.learnings/.gitkeep ``` ## Stackability Contract (Standalone + Multi-Skill) This skill is standalone-compatible and stackable with other self-improving skills. ### Namespaced Logging (recommended for 2+ skills) - Namespace for this skill: `.learnings/sales/` - Keep current standalone behavior if you prefer flat files. - Optional shared index for all skills: `.learnings/INDEX.md` ### Required Metadata Every new entry must include: ```markdown **Skill**: sales ``` ### Hook Arbitration (when 2+ skills are enabled) - Use one dispatcher hook as the single entrypoint. - Dispatcher responsibilities: route by matcher, dedupe repeated events, and rate-limit reminders. - Suggested defaults: dedupe key = `event + matcher + file + 5m_window`; max 1 reminder per skill every 5 minutes. ### Narrow Matcher Scope (sales) Only trigger this skill automatically for sales signals such as: - `pipeline|opportunity|objection|close-lost|win rate` - `quota|forecast|deal stage|discovery call|proposal` - explicit sales intent in user prompt ### Cross-Skill Precedence When guidance conflicts, apply: 1. `security` 2. `engineering` 3. `coding` 4. `ai` 5. user-explicit domain skill 6. `meta` as tie-breaker ### Ownership Rules - This skill writes only to `.learnings/sales/` in stackable mode. - It may read other skill folders for cross-linking, but should not rewrite their entries.

path: assets/FEATURE_REQUESTS.md
content: # Feature Requests

Sales tools, CRM automation, competitive intelligence, pipeline analytics, and deal execution capabilities requested during sales operations.

**Focus areas**: CRM workflows, competitive intelligence alerts, pipeline dashboards, forecast models, deal scoring, objection libraries, call transcript analysis, pricing calculators, proposal generators.

---


path: assets/ERRORS.md
content: # Deal Issues Log

Lost deals, pipeline leaks, pricing errors, forecast misses, and deal execution failures captured during sales operations.

**Triggers**: pipeline_review | deal_review | win_loss_analysis | forecast_review | CRM_audit | call_transcript
**Areas**: prospecting | qualification | discovery | proposal | negotiation | closing | renewal

## Status Definitions

| Status | Meaning |
|--------|---------|
| `pending` | Not yet addressed |
| `in_progress` | Actively being worked on (process change or deal rescue) |
| `resolved` | Issue addressed, prevention added |
| `wont_fix` | Decided not to address (reason in Resolution) |
| `promoted` | Elevated to battle card, pricing playbook, or qualification framework |
| `promoted_to_skill` | Extracted as a reusable skill |

---


path: assets/SKILL-TEMPLATE.md
content: # Sales Skill Template

Template for creating sales skills extracted from learnings and deal reviews. Copy and customize.

---

## SKILL.md Template

```markdown
---
name: skill-name-here
description: "Concise description of the sales skill and when to use it. Include trigger conditions."
---

# Skill Name

Brief introduction explaining the sales problem this skill addresses and its origin.

## Quick Reference

| Situation | Action |
|-----------|--------|
| [Sales trigger 1] | [Response or process 1] |
| [Sales trigger 2] | [Response or process 2] |

## Background

Why this sales knowledge matters. What deals it helps win. What revenue impact it has. Context from the original finding.

## The Approach

### Step-by-Step

1. First step with talk track or process change
2. Second step
3. Verification step (deal outcome, conversion rate, feedback)

### Talk Track Example

> **Prospect**: "[Objection or question]"
>
> **Rep**: "[Proven response]"
>
> **Follow-up**: "[Question to advance the conversation]"

## Common Variations

- **Variation A**: Different segment or deal size specifics
- **Variation B**: Alternative approach for different buyer persona

## Gotchas

- Warning or common mistake when applying this approach
- Edge case to watch for
- **NEVER** log customer PII or exact contract values

## Related

- Related battle card or objection handler
- Related qualification framework section
- Related pricing playbook entry

## Source

Extracted from sales learning or deal review.
- **Entry ID**: LRN-YYYYMMDD-XXX or DEAL-YYYYMMDD-XXX
- **Original Category**: objection_pattern | pipeline_leak | pricing_error | competitor_shift
- **Extraction Date**: YYYY-MM-DD
```

---

## Minimal Template

For simple sales skills:

```markdown
---
name: skill-name-here
description: "What this sales skill does and when to use it."
---

# Skill Name

[Sales problem statement in one sentence]

## Approach

[Talk track, process change, or qualification criteria]

## Source

- Entry ID: LRN-YYYYMMDD-XXX or DEAL-YYYYMMDD-XXX
```

---

## Template with Scripts

For sales skills that include analysis or detection helpers:

```markdown
---
name: skill-name-here
description: "What this sales skill does and when to use it."
---

# Skill Name

[Introduction]

## Quick Reference

| Command | Purpose |
|---------|---------|
| `./scripts/analyze.sh` | [What it analyzes] |
| `./scripts/detect.sh` | [What it detects] |

## Usage

### Automated (Recommended)

\`\`\`bash
./skills/skill-name/scripts/analyze.sh [target]
\`\`\`

### Manual Steps

1. Step one
2. Step two

## Scripts

| Script | Description |
|--------|-------------|
| `scripts/analyze.sh` | Pipeline or deal pattern analyzer |
| `scripts/detect.sh` | Objection or competitive signal detector |

## Source

- Entry ID: LRN-YYYYMMDD-XXX
```

---

## Naming Conventions

- **Skill name**: lowercase, hyphens for spaces
  - Good: `incumbent-displacement`, `enterprise-procurement-nav`, `budget-freeze-objection`
  - Bad: `IncumbentDisplacement`, `budget_freeze`, `objection1`

- **Description**: Start with action verb, mention sales trigger
  - Good: "Handles 'we already have a vendor' objection with differentiation framework. Use when prospect raises incumbent vendor during discovery or negotiation."
  - Bad: "Sales stuff"

- **Files**:
  - `SKILL.md` - Required, main documentation
  - `scripts/` - Optional, analysis and detection helpers
  - `references/` - Optional, detailed case studies
  - `assets/` - Optional, templates

---

## Extraction Checklist

Before creating a skill from a sales finding:

- [ ] Approach is verified (status: resolved, used successfully in 2+ deals)
- [ ] Solution is broadly applicable (not one-off deal or customer quirk)
- [ ] **No customer PII, exact contract values, or confidential terms**
- [ ] Content is complete (has all needed context for a rep to execute)
- [ ] Name follows conventions
- [ ] Description is concise but includes sales triggers
- [ ] Quick Reference table maps situations to actions
- [ ] Talk track examples are realistic and tested
- [ ] Source entry ID is recorded

After creating:

- [ ] Update original entry with `promoted_to_skill` status
- [ ] Add `Skill-Path: skills/skill-name` to entry metadata
- [ ] Test skill by reading it in a fresh session
- [ ] Verify no customer-sensitive data leaked into the skill
- [ ] Share with sales team for feedback


path: assets/LEARNINGS.md
content: # Sales Learnings

Objection patterns, competitor intelligence, pipeline insights, qualification gaps, and deal execution lessons captured during sales operations.

**Categories**: pipeline_leak | objection_pattern | pricing_error | forecast_miss | competitor_shift | deal_velocity_drop
**Areas**: prospecting | qualification | discovery | proposal | negotiation | closing | renewal
**Statuses**: pending | in_progress | resolved | wont_fix | promoted | promoted_to_skill

## Status Definitions

| Status | Meaning |
|--------|---------|
| `pending` | Not yet addressed |
| `in_progress` | Actively being worked on |
| `resolved` | Issue fixed or knowledge integrated |
| `wont_fix` | Decided not to address (reason in Resolution) |
| `promoted` | Elevated to battle card, objection script, pricing playbook, or qualification framework |
| `promoted_to_skill` | Extracted as a reusable skill |

## Skill Extraction Fields

When a learning is promoted to a skill, add these fields:

```markdown
**Status**: promoted_to_skill
**Skill-Path**: skills/skill-name
```

Example:
```markdown
## [LRN-20250415-001] objection_pattern

**Logged**: 2025-04-15T10:00:00Z
**Priority**: high
**Status**: promoted_to_skill
**Skill-Path**: skills/incumbent-displacement
**Area**: negotiation

### Summary
Framework for displacing incumbent vendors when prospect says "we already have a solution"
...
```

---


path: scripts/activator.sh
content: #!/bin/bash
# Sales Self-Improvement Activator Hook
# Triggers on UserPromptSubmit to remind about sales-specific learning capture
# Keep output minimal (~50-100 tokens) to minimize overhead

set -e

cat << 'EOF'
<sales-self-improvement-reminder>
After completing this sales task, evaluate if extractable knowledge emerged:
- Deal stuck or slipping past stage threshold? → DEAL_ISSUES.md (pipeline_leak)
- Objection you couldn't handle or heard before? → LEARNINGS.md (objection_pattern)
- Pricing mistake or unapproved discount? → DEAL_ISSUES.md (pricing_error)
- Forecast miss or deal push? → DEAL_ISSUES.md (forecast_miss)
- Lost deal to competitor or new competitive intel? → LEARNINGS.md (competitor_shift)
- Deal taking longer than expected to close? → LEARNINGS.md (deal_velocity_drop)

If recurring pattern (3+ deals): promote to battle card, objection script, or pricing playbook.
If broadly applicable: consider skill extraction (MEDDIC checklist, competitive framework).
</sales-self-improvement-reminder>
EOF


path: scripts/extract-skill.sh
content: #!/bin/bash
# Sales Skill Extraction Helper
# Creates a new skill from a sales learning entry
# Usage: ./extract-skill.sh <skill-name> [--dry-run]

set -e

SKILLS_DIR="./skills"

RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'

usage() {
    cat << EOF
Usage: $(basename "$0") <skill-name> [options]

Create a new sales skill from a learning entry.

Arguments:
  skill-name     Name of the skill (lowercase, hyphens for spaces)

Options:
  --dry-run      Show what would be created without creating files
  --output-dir   Relative output directory under current path (default: ./skills)
  -h, --help     Show this help message

Examples:
  $(basename "$0") incumbent-displacement
  $(basename "$0") meddic-stage-gates --dry-run
  $(basename "$0") budget-freeze-objection --output-dir ./skills/sales

The skill will be created in: \$SKILLS_DIR/<skill-name>/
EOF
}

log_info() {
    echo -e "${GREEN}[INFO]${NC} $1"
}

log_warn() {
    echo -e "${YELLOW}[WARN]${NC} $1"
}

log_error() {
    echo -e "${RED}[ERROR]${NC} $1" >&2
}

SKILL_NAME=""
DRY_RUN=false

while [[ $# -gt 0 ]]; do
    case $1 in
        --dry-run)
            DRY_RUN=true
            shift
            ;;
        --output-dir)
            if [ -z "${2:-}" ] || [[ "${2:-}" == -* ]]; then
                log_error "--output-dir requires a relative path argument"
                usage
                exit 1
            fi
            SKILLS_DIR="$2"
            shift 2
            ;;
        -h|--help)
            usage
            exit 0
            ;;
        -*)
            log_error "Unknown option: $1"
            usage
            exit 1
            ;;
        *)
            if [ -z "$SKILL_NAME" ]; then
                SKILL_NAME="$1"
            else
                log_error "Unexpected argument: $1"
                usage
                exit 1
            fi
            shift
            ;;
    esac
done

if [ -z "$SKILL_NAME" ]; then
    log_error "Skill name is required"
    usage
    exit 1
fi

if ! [[ "$SKILL_NAME" =~ ^[a-z0-9]+(-[a-z0-9]+)*$ ]]; then
    log_error "Invalid skill name format. Use lowercase letters, numbers, and hyphens only."
    log_error "Examples: 'incumbent-displacement', 'meddic-stage-gates', 'budget-freeze-objection'"
    exit 1
fi

if [[ "$SKILLS_DIR" = /* ]]; then
    log_error "Output directory must be a relative path under the current directory."
    exit 1
fi

if [[ "$SKILLS_DIR" =~ (^|/)\.\.(/|$) ]]; then
    log_error "Output directory cannot include '..' path segments."
    exit 1
fi

SKILLS_DIR="${SKILLS_DIR#./}"
SKILLS_DIR="./$SKILLS_DIR"

SKILL_PATH="$SKILLS_DIR/$SKILL_NAME"

if [ -d "$SKILL_PATH" ] && [ "$DRY_RUN" = false ]; then
    log_error "Skill already exists: $SKILL_PATH"
    log_error "Use a different name or remove the existing skill first."
    exit 1
fi

if [ "$DRY_RUN" = true ]; then
    log_info "Dry run - would create:"
    echo "  $SKILL_PATH/"
    echo "  $SKILL_PATH/SKILL.md"
    echo ""
    echo "Template content would be:"
    echo "---"
    cat << TEMPLATE
name: $SKILL_NAME
description: "[TODO: Describe the sales pattern, objection handler, or deal playbook this skill addresses]"
---

# $(echo "$SKILL_NAME" | sed 's/-/ /g' | awk '{for(i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) tolower(substr($i,2))}1')

[TODO: Brief introduction — what sales problem this solves]

## Quick Reference

| Situation | Action |
|-----------|--------|
| [Objection / deal trigger] | [Response or process to apply] |

## The Problem

[TODO: Describe the sales challenge, objection, or pipeline leak]

## Approach

### Talk Track

> **Prospect**: "[Objection or question]"
>
> **Rep**: "[Proven response]"
>
> **Follow-up**: "[Question to advance the deal]"

### Process Change

[TODO: Qualification criteria, stage gate, or pricing rule to implement]

## When to Use

- [Segment or deal size where this applies]
- [Stage in the sales cycle]
- [Competitor or industry context]

## Source

- Learning ID: [TODO: Add original learning ID]
- Category: [TODO: objection_pattern | pipeline_leak | pricing_error | competitor_shift]
- Segment: [TODO: SMB | mid_market | enterprise | strategic]
- Original File: .learnings/LEARNINGS.md
TEMPLATE
    echo "---"
    exit 0
fi

log_info "Creating sales skill: $SKILL_NAME"

mkdir -p "$SKILL_PATH"

cat > "$SKILL_PATH/SKILL.md" << TEMPLATE
---
name: $SKILL_NAME
description: "[TODO: Describe the sales pattern, objection handler, or deal playbook this skill addresses]"
---

# $(echo "$SKILL_NAME" | sed 's/-/ /g' | awk '{for(i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) tolower(substr($i,2))}1')

[TODO: Brief introduction — what sales problem this solves]

## Quick Reference

| Situation | Action |
|-----------|--------|
| [Objection / deal trigger] | [Response or process to apply] |

## The Problem

[TODO: Describe the sales challenge, objection, or pipeline leak]

## Approach

### Talk Track

> **Prospect**: "[Objection or question]"
>
> **Rep**: "[Proven response]"
>
> **Follow-up**: "[Question to advance the deal]"

### Process Change

[TODO: Qualification criteria, stage gate, or pricing rule to implement]

## When to Use

- [Segment or deal size where this applies]
- [Stage in the sales cycle]
- [Competitor or industry context]

## Source

- Learning ID: [TODO: Add original learning ID]
- Category: [TODO: objection_pattern | pipeline_leak | pricing_error | competitor_shift]
- Segment: [TODO: SMB | mid_market | enterprise | strategic]
- Original File: .learnings/LEARNINGS.md
TEMPLATE

log_info "Created: $SKILL_PATH/SKILL.md"

echo ""
log_info "Skill scaffold created."
echo ""
echo "Next steps:"
echo "  1. Edit $SKILL_PATH/SKILL.md"
echo "  2. Fill in the TODO sections with talk tracks and deal context"
echo "  3. Add proof points (customer stories, win rate data)"
echo "  4. Add references/ folder if you have detailed case studies"
echo "  5. Update the original learning entry with:"
echo "     **Status**: promoted_to_skill"
echo "     **Skill-Path**: skills/$SKILL_NAME"


path: scripts/error-detector.sh
content: #!/bin/bash
# Sales Self-Improvement Error Detector Hook
# Triggers on PostToolUse for Bash to detect deal-related signals
# Reads CLAUDE_TOOL_OUTPUT environment variable

set -e

OUTPUT="${CLAUDE_TOOL_OUTPUT:-}"

ERROR_PATTERNS=(
    "lost deal"
    "churned"
    "discount"
    "competitor"
    "objection"
    "forecast"
    "pipeline"
    "quota"
    "slipped"
    "stalled"
    "no decision"
    "lost to"
    "deal lost"
    "churn"
    "pushed deal"
    "missed forecast"
    "over-forecast"
    "under-forecast"
    "pricing error"
    "wrong price"
    "deprecated tier"
    "budget freeze"
    "no budget"
    "went dark"
    "ghosted"
    "declined meeting"
    "champion left"
    "reorg"
    "procurement delay"
    "legal delay"
    "security review"
    "RFP"
    "competitive eval"
    "vendor switch"
    "free tier"
    "undercut"
    "win rate"
    "close rate"
    "conversion rate"
    "stage duration"
    "days in stage"
)

contains_error=false
for pattern in "${ERROR_PATTERNS[@]}"; do
    if [[ "$OUTPUT" == *"$pattern"* ]]; then
        contains_error=true
        break
    fi
done

if [ "$contains_error" = true ]; then
    cat << 'EOF'
<sales-issue-detected>
A sales signal was detected in command output. Consider logging to .learnings/ if:
- Deal lost or churned → DEAL_ISSUES.md [DEAL-YYYYMMDD-XXX] with loss reason
- Competitor mentioned or undercut pricing → LEARNINGS.md with competitor_shift category
- Objection pattern surfaced → LEARNINGS.md with objection_pattern category
- Forecast or pipeline metric missed → DEAL_ISSUES.md with forecast_miss category
- Discount or pricing issue → DEAL_ISSUES.md with pricing_error category
- Deal stalled or slipped → DEAL_ISSUES.md with pipeline_leak category

Include deal context (anonymized), segment, and area tag.
</sales-issue-detected>
EOF
fi


path: hooks/openclaw/handler.js
content: /**
 * Self-Improving Sales Hook for OpenClaw
 *
 * Injects a sales-specific reminder to evaluate learnings during agent bootstrap.
 * Fires on agent:bootstrap event before workspace files are injected.
 */

const REMINDER_CONTENT = `
## Sales Self-Improvement Reminder

After completing sales tasks, evaluate if any learnings should be captured:

**Log deal issues when:**
- Deal stuck in same stage >30 days → \`.learnings/DEAL_ISSUES.md\` (pipeline_leak)
- Pricing mistake or unapproved discount → \`.learnings/DEAL_ISSUES.md\` (pricing_error)
- Forecast miss >20% on committed deal → \`.learnings/DEAL_ISSUES.md\` (forecast_miss)
- Deal lost post-mortem reveals process gap → \`.learnings/DEAL_ISSUES.md\`

**Log learnings when:**
- Objection you couldn't handle → \`.learnings/LEARNINGS.md\` (objection_pattern)
- Lost deal to competitor → \`.learnings/LEARNINGS.md\` (competitor_shift)
- Deal velocity dropping in a segment → \`.learnings/LEARNINGS.md\` (deal_velocity_drop)
- Pipeline leak pattern at specific stage → \`.learnings/LEARNINGS.md\` (pipeline_leak)

**Log feature requests when:**
- Sales tool or CRM automation needed → \`.learnings/FEATURE_REQUESTS.md\`

**Promote when pattern is proven (3+ deals):**
- Objection patterns → battle cards or objection handling scripts
- Competitor intelligence → competitive battle cards
- Pricing insights → pricing playbooks
- Qualification gaps → MEDDIC/BANT framework updates

Include deal context (anonymized), exact objection wording, and area tag.
`.trim();

const handler = async (event) => {
  if (!event || typeof event !== 'object') {
    return;
  }

  if (event.type !== 'agent' || event.action !== 'bootstrap') {
    return;
  }

  if (!event.context || typeof event.context !== 'object') {
    return;
  }

  if (Array.isArray(event.context.bootstrapFiles)) {
    event.context.bootstrapFiles.push({
      path: 'SALES_SELF_IMPROVEMENT_REMINDER.md',
      content: REMINDER_CONTENT,
      virtual: true,
    });
  }
};

module.exports = handler;
module.exports.default = handler;


path: hooks/openclaw/HOOK.md
content: ---
name: self-improving-sales
description: "Injects sales self-improvement reminder during agent bootstrap"
metadata: {"openclaw":{"emoji":"💼","events":["agent:bootstrap"]}}
---

# Self-Improving Sales Hook

Injects a reminder to evaluate sales learnings during agent bootstrap.

## What It Does

- Fires on `agent:bootstrap` (before workspace files are injected)
- Adds a sales-specific reminder block to check `.learnings/` for relevant entries
- Prompts the agent to log deal issues, objection patterns, pricing errors, forecast misses, competitor shifts, and deal velocity drops

## Reminder Content

The hook injects reminders to log to the appropriate file based on what occurred:

| Trigger | Target File | Category |
|---------|-------------|----------|
| Deal stuck in stage >30 days | `DEAL_ISSUES.md` | pipeline_leak |
| Objection you couldn't handle | `LEARNINGS.md` | `objection_pattern` |
| Pricing mistake discovered | `DEAL_ISSUES.md` | pricing_error |
| Forecast missed by >20% | `DEAL_ISSUES.md` | forecast_miss |
| Lost deal to competitor | `LEARNINGS.md` | `competitor_shift` |
| Deal velocity slowing | `LEARNINGS.md` | `deal_velocity_drop` |
| Sales tool or capability needed | `FEATURE_REQUESTS.md` | feature_request |

## Configuration

No configuration needed. Enable with:

```bash
openclaw hooks enable self-improving-sales
```


path: hooks/openclaw/handler.ts
content: /**
 * Self-Improving Sales Hook for OpenClaw
 *
 * Injects a sales-specific reminder to evaluate learnings during agent bootstrap.
 * Fires on agent:bootstrap event before workspace files are injected.
 */

import type { HookHandler } from 'openclaw/hooks';

const REMINDER_CONTENT = `## Sales Self-Improvement Reminder

After completing sales tasks, evaluate if any learnings should be captured:

**Log deal issues when:**
- Deal stuck in same stage >30 days → \`.learnings/DEAL_ISSUES.md\` (pipeline_leak)
- Pricing mistake or unapproved discount → \`.learnings/DEAL_ISSUES.md\` (pricing_error)
- Forecast miss >20% on committed deal → \`.learnings/DEAL_ISSUES.md\` (forecast_miss)
- Deal lost post-mortem reveals process gap → \`.learnings/DEAL_ISSUES.md\`

**Log learnings when:**
- Objection you couldn't handle → \`.learnings/LEARNINGS.md\` (objection_pattern)
- Lost deal to competitor → \`.learnings/LEARNINGS.md\` (competitor_shift)
- Deal velocity dropping in a segment → \`.learnings/LEARNINGS.md\` (deal_velocity_drop)
- Pipeline leak pattern at specific stage → \`.learnings/LEARNINGS.md\` (pipeline_leak)

**Log feature requests when:**
- Sales tool or CRM automation needed → \`.learnings/FEATURE_REQUESTS.md\`

**Promote when pattern is proven (3+ deals):**
- Objection patterns → battle cards or objection handling scripts
- Competitor intelligence → competitive battle cards
- Pricing insights → pricing playbooks
- Qualification gaps → MEDDIC/BANT framework updates

Include deal context (anonymized), exact objection wording, and area tag.`;

const handler: HookHandler = async (event) => {
  if (!event || typeof event !== 'object') {
    return;
  }

  if (event.type !== 'agent' || event.action !== 'bootstrap') {
    return;
  }

  if (!event.context || typeof event.context !== 'object') {
    return;
  }

  const sessionKey = event.sessionKey || '';
  if (sessionKey.includes(':subagent:')) {
    return;
  }

  if (Array.isArray(event.context.bootstrapFiles)) {
    event.context.bootstrapFiles.push({
      path: 'SALES_SELF_IMPROVEMENT_REMINDER.md',
      content: REMINDER_CONTENT,
      virtual: true,
    });
  }
};

export default handler;


path: references/examples.md
content: # Entry Examples

Concrete examples of well-formatted sales entries with all fields.

## Learning: Objection Pattern ("We already have a vendor")

```markdown
## [LRN-20250415-001] objection_pattern

**Logged**: 2025-04-15T10:30:00Z
**Priority**: high
**Status**: pending
**Area**: discovery

### Summary
"We already have a vendor for this" — no differentiation message ready

### Details
Prospect VP of Operations said "We already have a vendor for this, we're happy with
them" during initial discovery call. Rep had no prepared differentiation message for
the incumbent (Vendor X). Conversation stalled and prospect declined a second meeting.
This is the 4th time this quarter a deal died at discovery against Vendor X without
a clear differentiation narrative.

### Deal Context

**Objection / Situation:**
> "We already use Vendor X for this. They've been our partner for three years
> and we're happy with the relationship."

**Response Used:**
> "I understand. We just think we can offer some improvements."

**Outcome:**
Lost — prospect declined follow-up. No differentiation articulated.

### Suggested Action
Create battle card for Vendor X with:
1. Trap-setting discovery questions that expose Vendor X's known weaknesses
2. Differentiation framework: what we do that Vendor X cannot
3. Customer proof points: companies that switched from Vendor X and results achieved

### Metadata
- Source: call_transcript
- Deal Size: $100K-$250K
- Segment: mid_market
- Industry: technology
- Related Deals: DEAL-20250320-002, DEAL-20250401-003
- Tags: objection, incumbent, vendor-x, differentiation, discovery
- Pattern-Key: objection.incumbent_vendor
- Recurrence-Count: 4
- First-Seen: 2025-01-22
- Last-Seen: 2025-04-15

---
```

## Learning: Competitor Shift (Free Tier Launch)

```markdown
## [LRN-20250416-001] competitor_shift

**Logged**: 2025-04-16T09:15:00Z
**Priority**: high
**Status**: pending
**Area**: qualification

### Summary
Competitor Y launched a free tier, losing SMB deals that previously closed at $15K-$30K ARR

### Details
Competitor Y announced a free tier covering up to 5 users with core features on April 1st.
Since then, 6 SMB prospects in the pipeline have either gone dark or explicitly said they're
evaluating the free option. Our SMB win rate dropped from 42% to 18% in the two weeks since
announcement. The free tier lacks advanced reporting, integrations, and SLA guarantees that
our paid plans include.

### Deal Context

**Objection / Situation:**
> "We saw Competitor Y just launched a free version. Can you match that or explain
> why we should pay when they're offering it for free?"

**Response Used:**
> Various — no consistent counter-messaging deployed yet.

**Outcome:**
3 lost to free tier, 3 stalled pending "internal review"

### Suggested Action
1. Create competitive battle card for Competitor Y free tier
2. Build TCO calculator showing hidden costs of free tier (migration, support, limits)
3. Develop talk track: "Free gets you started, but here's what it costs when you scale"
4. Consider SMB-specific pricing response (starter tier or extended trial)

### Metadata
- Source: competitor_intel
- Deal Size: $15K-$30K
- Segment: SMB
- Industry: technology
- Tags: competitor-y, free-tier, SMB, pricing-pressure, win-rate
- Pattern-Key: competitor.free_tier_launch

---
```

## Learning: Pipeline Leak (Proposal Stage)

```markdown
## [LRN-20250417-001] pipeline_leak

**Logged**: 2025-04-17T14:00:00Z
**Priority**: medium
**Status**: pending
**Area**: proposal

### Summary
Deals dying at proposal stage due to slow legal review — 23-day average wait vs. 5-day target

### Details
Analyzed Q1 pipeline and found 34% of deals that reached proposal stage ultimately died there.
Root cause: legal review of MSA/DPA takes an average of 23 business days. Prospects lose
momentum, re-engage competitors, or deprioritize the project. Deals under $100K are
particularly affected because legal treats them with the same rigor as enterprise deals.

### Deal Context

**Objection / Situation:**
> "We're ready to move forward but your legal team hasn't returned the redlines in
> three weeks. We need this resolved by end of quarter or we're going with [competitor]."

**Response Used:**
> Escalated to VP Sales who escalated to General Counsel. Resolved in 2 more days
> but relationship was strained.

**Outcome:**
Won (barely) — but pattern repeats. 8 of 14 proposal-stage losses in Q1 cited legal delay.

### Suggested Action
1. Pre-approved MSA template for deals under $100K (skip custom legal review)
2. SLA with legal: 5-day turnaround for standard terms, 10-day for custom
3. Send legal paperwork in parallel with proposal, not sequentially
4. Add legal readiness as a stage gate before advancing to proposal

### Metadata
- Source: pipeline_review
- Deal Size: $50K-$250K
- Segment: mid_market
- Tags: legal, MSA, proposal-stage, pipeline-leak, velocity
- Pattern-Key: pipeline_leak.legal_review_delay
- Recurrence-Count: 8
- First-Seen: 2025-01-15
- Last-Seen: 2025-04-17

---
```

## Deal Issue: Forecast Miss (Q2 Over-Forecast)

```markdown
## [DEAL-20250415-001] forecast_miss

**Logged**: 2025-04-15T16:00:00Z
**Priority**: critical
**Status**: pending
**Area**: closing

### Summary
Q2 forecast 40% over actual — $2.1M committed vs. $1.26M closed, primarily due to pushed enterprise deals

### Deal Details
- **Stage**: Closing (Stage 5+)
- **Deal Size**: $500K+ (aggregate)
- **Days in Stage**: Various (15-45 days past projected close)
- **Segment**: enterprise

### What Happened
Five enterprise deals totaling $840K that were in "commit" status for Q2 did not close:
- Two pushed to Q3 due to budget re-approval (new fiscal year)
- One lost to competitor after 11th-hour pricing undercut
- One went to "no decision" after champion left the company
- One delayed by procurement requiring additional security review

### Root Cause
Over-reliance on rep-reported confidence without verifying:
1. Budget approval was actually in place (not just "verbal")
2. Champion still had organizational authority
3. Procurement timeline was validated with procurement (not just the champion)
4. Competitive situation was truly resolved

### Impact
- Revenue shortfall: $840K (40% of committed pipeline)
- Board reporting required revision
- Team compensation affected (accelerators not triggered)
- Credibility with finance damaged for future forecasting

### Prevention
1. Require written budget confirmation before "commit" status
2. Validate champion authority with second contact in account
3. Add procurement timeline verification as commit criteria
4. Implement "champion risk" flag when contacts change roles
5. Forecast calls should challenge every commit deal with specific evidence

### Metadata
- Trigger: forecast_review
- Loss Reason: timing (2), lost_to_competitor (1), no_decision (1), product_gap (0), price (1)
- See Also: DEAL-20250110-003 (Q1 similar pattern, 25% miss)

---
```

## Deal Issue: Pricing Error (Deprecated Tier)

```markdown
## [DEAL-20250416-001] pricing_error

**Logged**: 2025-04-16T11:30:00Z
**Priority**: high
**Status**: pending
**Area**: proposal

### Summary
Quoted deprecated "Growth" pricing tier to enterprise prospect — $45/user/month instead of current $65/user/month

### Deal Details
- **Stage**: Proposal
- **Deal Size**: $100K-$250K
- **Days in Stage**: 5
- **Segment**: enterprise

### What Happened
AE used an outdated pricing sheet (Q3 2024) that still listed the "Growth" tier at
$45/user/month. Current pricing is $65/user/month for "Business" tier (Growth was
sunset in Q4 2024). Prospect received the quote, got internal approval at the lower
price point, and now expects to close at $45. Honoring the quote costs $48K ARR;
revising it risks losing the deal and trust.

### Root Cause
1. Outdated pricing PDF still accessible in shared drive
2. No version control or expiration date on pricing documents
3. CRM CPQ not enforced — reps can send manual quotes
4. No pricing approval workflow for non-standard quotes

### Impact
- $48K ARR gap if honored vs. current pricing
- Prospect trust damage if revised upward
- Sets precedent for other reps using outdated materials

### Prevention
1. Archive all deprecated pricing documents with "DEPRECATED" watermark
2. Enforce CPQ for all quotes — block manual pricing
3. Add pricing version validation in proposal review checklist
4. Quarterly pricing audit: search for any references to sunset tiers

### Metadata
- Trigger: deal_review
- Related Files: pricing/growth-tier-sunset-notice.md
- See Also: DEAL-20250220-002 (similar pricing document version issue)

---
```

## Feature Request: Automated Competitive Intelligence Alerts

```markdown
## [FEAT-20250415-001] competitive_intelligence_alerts

**Logged**: 2025-04-15T17:00:00Z
**Priority**: high
**Status**: pending
**Area**: prospecting

### Requested Capability
Automated alerts when competitors announce pricing changes, product launches,
leadership changes, or funding rounds. Delivered to Slack #competitive-intel
channel with summary and recommended battle card updates.

### User Context
Competitor Y's free tier launch caught the team off-guard for 2 weeks before
a coordinated response was developed. During that window, 6 SMB deals were
affected. Real-time competitive intelligence would allow same-day response
with updated positioning and talk tracks.

### Complexity Estimate
medium

### Suggested Implementation
1. Monitor competitor websites, press releases, and G2/Gartner reviews via RSS + web scraping
2. Track competitor job postings for signals (hiring in new markets, new product areas)
3. Aggregate call transcript mentions of competitors (Gong/Chorus integration)
4. Slack bot posts daily digest of competitive signals with severity rating
5. Auto-flag deals in CRM where mentioned competitor has recent activity

### Metadata
- Frequency: recurring
- Related Features: CRM competitive field, call transcript analysis, battle card system

---
```

## Learning: Promoted to Battle Card

```markdown
## [LRN-20250410-003] objection_pattern

**Logged**: 2025-04-10T11:00:00Z
**Priority**: high
**Status**: promoted
**Promoted**: battle card (BATTLECARDS/vendor-x.md)
**Area**: negotiation

### Summary
"Your product is too expensive compared to Vendor X" — need ROI reframe

### Details
Found in 9 deals over Q1. Vendor X undercuts on price by 20-30% but lacks
our advanced analytics, dedicated CSM, and 99.99% SLA. Reps who successfully
countered this objection used ROI framing: "Our customers see 3x return within
6 months" backed by case studies. Reps who competed on price lost every time.

### Deal Context

**Objection / Situation:**
> "Vendor X quoted us 25% less. Why should we pay more?"

**Response Used (winning):**
> "That's a fair question. Let me share what Company Z found — they evaluated
> both and chose us because [specific capability] saved them $200K in the
> first year. The price difference pays for itself in [timeframe]."

**Outcome:**
Won 6 of 9 deals where ROI reframe was used. Lost 3 where rep matched price.

### Suggested Action
Added to Vendor X battle card: never compete on price, always reframe to ROI
and total cost of ownership. Include 3 customer proof points with specific
dollar savings.

### Metadata
- Source: win_loss_analysis
- Deal Size: $100K-$500K
- Segment: mid_market
- Industry: technology, financial_services
- Tags: pricing, vendor-x, ROI, battle-card, objection
- Pattern-Key: objection.price_comparison
- Recurrence-Count: 9
- First-Seen: 2025-01-08
- Last-Seen: 2025-04-10

---
```

## Learning: Promoted to Skill (MEDDIC Qualification Checklist)

```markdown
## [LRN-20250412-001] pipeline_leak

**Logged**: 2025-04-12T15:00:00Z
**Priority**: high
**Status**: promoted_to_skill
**Skill-Path**: skills/meddic-stage-gates
**Area**: qualification

### Summary
Systematic MEDDIC qualification checklist with hard stage gates to prevent unqualified deals from advancing

### Details
Analyzed 50 lost deals from H2 2024. Found that 72% of lost deals were missing
at least 2 MEDDIC criteria when they advanced past discovery. Deals with all 6
MEDDIC elements validated by Stage 3 closed at 58% vs. 14% for those missing 2+
elements. Created a mandatory checklist with hard gates: deal cannot advance
without completing minimum criteria for each stage.

### Suggested Action
Implemented as CRM stage gate validation:
1. Metrics: Quantified business impact documented
2. Economic Buyer: Identified by name and confirmed access
3. Decision Criteria: Written and validated with prospect
4. Decision Process: Timeline, steps, and approvals mapped
5. Identify Pain: Specific pain tied to business metric
6. Champion: Named, tested, and actively selling internally

### Metadata
- Source: win_loss_analysis
- Deal Size: $50K-$500K+
- Segment: mid_market, enterprise
- Tags: MEDDIC, qualification, stage-gates, pipeline-hygiene, win-rate
- See Also: LRN-20250320-002, DEAL-20250401-005, DEAL-20250415-001

---
```


path: references/openclaw-integration.md
content: # OpenClaw Integration

Complete setup and usage guide for integrating the self-improving-sales skill with OpenClaw.

## Overview

OpenClaw uses workspace-based prompt injection combined with event-driven hooks. Context is injected from workspace files at session start, and hooks can trigger on lifecycle events.

## Workspace Structure

```
~/.openclaw/
├── workspace/                   # Working directory
│   ├── AGENTS.md               # Multi-agent coordination patterns
│   ├── SOUL.md                 # Behavioral guidelines and personality
│   ├── TOOLS.md                # Tool capabilities and gotchas
│   ├── MEMORY.md               # Long-term memory (main session only)
│   └── memory/                 # Daily memory files
│       └── YYYY-MM-DD.md
├── skills/                      # Installed skills
│   └── self-improving-sales/
│       └── SKILL.md
└── hooks/                       # Custom hooks
    └── self-improving-sales/
        ├── HOOK.md
        └── handler.ts
```

## Quick Setup

### 1. Install the Skill

```bash
clawdhub install self-improving-sales
```

Or copy manually:

```bash
cp -r self-improving-sales ~/.openclaw/skills/
```

### 2. Install the Hook (Optional)

```bash
cp -r hooks/openclaw ~/.openclaw/hooks/self-improving-sales
openclaw hooks enable self-improving-sales
```

### 3. Create Learning Files

```bash
mkdir -p ~/.openclaw/workspace/.learnings
```

## Promotion Targets (Sales-Specific)

When sales learnings prove broadly applicable, promote them to workspace files:

| Learning Type | Promote To | Example |
|---------------|------------|---------|
| Objection patterns | Objection handling scripts | "When they say 'too expensive', reframe to ROI" |
| Competitor intelligence | Battle cards | "Competitor Y free tier — counter with TCO analysis" |
| Qualification gaps | MEDDIC/BANT frameworks | "Always confirm budget approval in writing before commit" |
| Pricing patterns | Pricing playbooks | "Never discount >15% without VP approval + multi-year" |
| Win/loss patterns | Deal review templates | "No champion by Stage 3 = 12% close rate" |
| Process improvements | `AGENTS.md` | "Update CRM within 24 hours of every meeting" |

### Promotion Decision Tree

```
Is the learning deal-specific?
├── Yes → Keep in .learnings/
└── No → Is it an objection pattern?
    ├── Yes → Promote to battle card or objection handler
    └── No → Is it competitive intelligence?
        ├── Yes → Promote to battle card
        └── No → Is it a qualification insight?
            ├── Yes → Promote to MEDDIC/BANT framework
            └── No → Promote to pricing playbook or AGENTS.md
```

## Sales-Specific Detection Triggers

| Trigger | Action | Target |
|---------|--------|--------|
| Deal stuck >30 days | Log deal issue | DEAL_ISSUES.md (pipeline_leak) |
| Objection couldn't handle | Log learning | LEARNINGS.md (objection_pattern) |
| Pricing mistake found | Log deal issue | DEAL_ISSUES.md (pricing_error) |
| Forecast miss >20% | Log deal issue | DEAL_ISSUES.md (forecast_miss) |
| Lost to competitor | Log learning | LEARNINGS.md (competitor_shift) |
| Deal velocity dropping | Log learning | LEARNINGS.md (deal_velocity_drop) |
| Discount >20% requested | Log deal issue | DEAL_ISSUES.md (pricing_error) |

## Inter-Agent Communication

OpenClaw provides tools for cross-session communication. Use only when cross-session sharing is explicitly needed.

### sessions_send

Share a deal pattern with another session:
```
sessions_send(sessionKey="session-id", message="Competitor Y launched free tier — update all SMB deal battle cards")
```

### sessions_spawn

Spawn a background agent to analyze deal patterns:
```
sessions_spawn(task="Analyze .learnings/DEAL_ISSUES.md for promotion candidates", label="deal-review")
```

## Available Hook Events

| Event | When It Fires |
|-------|---------------|
| `agent:bootstrap` | Before workspace files inject |
| `command:new` | When `/new` command issued |
| `command:reset` | When `/reset` command issued |
| `command:stop` | When `/stop` command issued |
| `gateway:startup` | When gateway starts |

## Verification

```bash
openclaw hooks list        # Check hook is registered
openclaw status            # Check skill is loaded
```

## Troubleshooting

### Hook not firing
1. Ensure hooks enabled in config
2. Restart gateway after config changes
3. Check gateway logs for errors

### Learnings not persisting
1. Verify `.learnings/` directory exists
2. Check file permissions
3. Ensure workspace path is configured correctly

### Skill not loading
1. Check skill is in skills directory
2. Verify SKILL.md has correct frontmatter
3. Run `openclaw status` to see loaded skills


path: references/hooks-setup.md
content: # Hook Setup Guide

Configure automatic sales self-improvement triggers for AI agents.

## Overview

Hooks enable proactive sales-pattern capture by injecting reminders at key moments:
- **UserPromptSubmit**: Reminder after each prompt to evaluate deal learnings
- **PostToolUse (Bash)**: Signal detection when deal-related keywords appear in output

## Claude Code Setup

### Option 1: Project-Level Configuration

Create `.claude/settings.json` in your project root:

```json
{
  "hooks": {
    "UserPromptSubmit": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "./skills/self-improving-sales/scripts/activator.sh"
          }
        ]
      }
    ],
    "PostToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "./skills/self-improving-sales/scripts/error-detector.sh"
          }
        ]
      }
    ]
  }
}
```

### Option 2: User-Level Configuration

Add to `~/.claude/settings.json` for global activation:

```json
{
  "hooks": {
    "UserPromptSubmit": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "~/.claude/skills/self-improving-sales/scripts/activator.sh"
          }
        ]
      }
    ]
  }
}
```

### Minimal Setup (Activator Only)

For lower overhead, use only the UserPromptSubmit hook:

```json
{
  "hooks": {
    "UserPromptSubmit": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "./skills/self-improving-sales/scripts/activator.sh"
          }
        ]
      }
    ]
  }
}
```

## Codex CLI Setup

Codex uses the same hook system. Create `.codex/settings.json`:

```json
{
  "hooks": {
    "UserPromptSubmit": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "./skills/self-improving-sales/scripts/activator.sh"
          }
        ]
      }
    ]
  }
}
```

## GitHub Copilot Setup

Copilot doesn't support hooks. Add guidance to `.github/copilot-instructions.md`:

```markdown
## Sales Self-Improvement

After sales tasks or deal reviews, consider logging to `.learnings/`:
- Deal issues, pipeline leaks, pricing errors → DEAL_ISSUES.md
- Objection patterns, competitor intel, velocity drops → LEARNINGS.md
- Tool/capability requests → FEATURE_REQUESTS.md

Promote recurring patterns to battle cards, objection scripts, or pricing playbooks.
```

## Verification

### Test Activator Hook

1. Enable the hook configuration
2. Start a new Claude Code session
3. Send any prompt
4. Verify you see `<sales-self-improvement-reminder>` in the context

### Test Error Detector Hook

1. Enable PostToolUse hook for Bash
2. Run a command that produces deal-related output (e.g., a CRM export with "lost deal")
3. Verify you see `<sales-issue-detected>` reminder

### Dry Run Extract Script

```bash
./skills/self-improving-sales/scripts/extract-skill.sh test-skill --dry-run
```

## Troubleshooting

### Hook Not Triggering

1. **Check script permissions**: `chmod +x scripts/*.sh`
2. **Verify path**: Use absolute paths or paths relative to project root
3. **Check settings location**: Project vs user-level settings
4. **Restart session**: Hooks are loaded at session start

### Permission Denied

```bash
chmod +x ./skills/self-improving-sales/scripts/activator.sh
chmod +x ./skills/self-improving-sales/scripts/error-detector.sh
chmod +x ./skills/self-improving-sales/scripts/extract-skill.sh
```

### Script Not Found

If using relative paths, ensure you're in the correct directory or use absolute paths:

```json
{
  "command": "/absolute/path/to/skills/self-improving-sales/scripts/activator.sh"
}
```

### Too Much Overhead

If the activator feels intrusive:

1. **Use minimal setup**: Only UserPromptSubmit, skip PostToolUse
2. **Add matcher filter**: Only trigger for sales-related prompts:

```json
{
  "matcher": "deal|pipeline|forecast|objection|competitor|pricing|quota",
  "hooks": [...]
}
```

## Hook Output Budget

The activator is designed to be lightweight:
- **Target**: ~50-100 tokens per activation
- **Content**: Structured sales-specific reminder, not verbose instructions
- **Format**: XML tags for easy parsing

## Security Considerations

- Hook scripts run with the same permissions as the agent
- Scripts only output text; they don't modify files or run commands
- Error detector reads `CLAUDE_TOOL_OUTPUT` environment variable
- Treat `CLAUDE_TOOL_OUTPUT` as potentially sensitive; do not log verbatim
- Never log customer PII, deal amounts, or confidential terms
- All scripts are opt-in
- Recommended default: enable `UserPromptSubmit` only; add `PostToolUse` when you want deal signal detection

## Disabling Hooks

To temporarily disable without removing configuration:

1. Comment out in settings
2. Or delete the settings file — hooks won't run without configuration


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (CRITICAL)