From cb2b3816a6156d952a06e7cde7ce8c249d7db4b3 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 23 Mar 2026 07:35:26 +0000 Subject: [PATCH] refactor: modular 80/20 skill architecture isolation Reorganize repository to follow proper modular skill structure: - Move skill files into skills/pareto-audit/ directory - Add SKILL.md registry definition with PCE execution protocol - Add Cloudflare Worker implementation (src/worker.js) - Add deployment config (wrangler.jsonc) and deploy script - Move examples to skills/pareto-audit/examples/ - Move registry to registry/index.jsonl - Move docs to docs/adding-a-skill.md Follows Pareto principle: vital 20% (SKILL.md, worker.js, examples) delivers 80% of value. https://claude.ai/code/session_01Ktv4Z3zMmJ3Va6ZnMHrmA6 --- adding-a-skill.md => docs/adding-a-skill.md | 0 .../pareto-repo/skills/pareto-audit/README.md | 79 ---- index.jsonl => registry/index.jsonl | 0 skills/pareto-audit/README.md | 124 +++++ skills/pareto-audit/SKILL.md | 177 ++++++++ skills/pareto-audit/deploy.sh | 48 ++ .../examples/engineering-team-2026-03.json | 0 .../examples/product-manager-2026-03.json | 0 .../examples/startup-founder-2026-03.json | 0 skills/pareto-audit/src/worker.js | 423 ++++++++++++++++++ skills/pareto-audit/wrangler.jsonc | 41 ++ 11 files changed, 813 insertions(+), 79 deletions(-) rename adding-a-skill.md => docs/adding-a-skill.md (100%) delete mode 100644 mnt/user-data/outputs/pareto-repo/skills/pareto-audit/README.md rename index.jsonl => registry/index.jsonl (100%) create mode 100644 skills/pareto-audit/README.md create mode 100644 skills/pareto-audit/SKILL.md create mode 100755 skills/pareto-audit/deploy.sh rename engineering-team-2026-03.json => skills/pareto-audit/examples/engineering-team-2026-03.json (100%) rename product-manager-2026-03.json => skills/pareto-audit/examples/product-manager-2026-03.json (100%) rename startup-founder-2026-03.json => skills/pareto-audit/examples/startup-founder-2026-03.json (100%) create mode 100644 skills/pareto-audit/src/worker.js create mode 100644 skills/pareto-audit/wrangler.jsonc diff --git a/adding-a-skill.md b/docs/adding-a-skill.md similarity index 100% rename from adding-a-skill.md rename to docs/adding-a-skill.md diff --git a/mnt/user-data/outputs/pareto-repo/skills/pareto-audit/README.md b/mnt/user-data/outputs/pareto-repo/skills/pareto-audit/README.md deleted file mode 100644 index 80b5193..0000000 --- a/mnt/user-data/outputs/pareto-repo/skills/pareto-audit/README.md +++ /dev/null @@ -1,79 +0,0 @@ -# pareto-audit — AI-Powered 80/20 Workflow Audit - -**Skill ID:** `pareto-audit` · **Version:** 1.0.0 · **Complexity:** 6.5 · **Reproducibility:** 0.81 - -Identifies the 20% of inputs driving 80% of outputs across any domain. Produces ranked action matrix, pruning recommendations, and unconventional reframes via the Pareto Cognitive Engine (PCE). - ---- - -## Deployment - -**Live URL:** `https://pareto.genesisconductor.io` -**Runtime:** Cloudflare Worker (single file, serves HTML + API proxy) -**Auth:** Anthropic API key (`ANTHROPIC_API_KEY` Wrangler secret) -**Rate limit:** 3 free audits/day/IP via Cloudflare KV - -```bash -chmod +x deploy.sh -./deploy.sh -``` - ---- - -## API - -```bash -POST https://pareto.genesisconductor.io/api/audit -Content-Type: application/json - -{ - "domain": "startup", - "goal": "Reach $10K MRR in 90 days", - "activities": ["Cold outreach", "Discovery calls", "Feature building"], - "outputs": "Optional observed metrics" -} -``` - -Response: JSON matching the PCE output schema (see `SKILL.md`). - ---- - -## Example Results - -Validated outputs in `examples/` — ground truth corpus for regression testing and showcasing: - -| File | Domain | Key Finding | -|---|---|---| -| [`startup-founder-2026-03.json`](examples/startup-founder-2026-03.json) | Startup | Inbound conversion + discovery calls = 75% of output. Pause cold outreach. | -| [`engineering-team-2026-03.json`](examples/engineering-team-2026-03.json) | Engineering | PR cycle time (3.2 days) is the single throughput constraint. | -| [`product-manager-2026-03.json`](examples/product-manager-2026-03.json) | Product | 40% churn attributable to incomplete onboarding — one fixable step. | - ---- - -## Files - -``` -pareto-audit/ -├── SKILL.md # multi-skill-orchestrator-mcp registry definition -├── README.md # This file -├── src/ -│ └── worker.js # Cloudflare Worker (frontend + API) -├── wrangler.jsonc # Wrangler config -├── deploy.sh # One-command deployment -└── examples/ - ├── startup-founder-2026-03.json - ├── engineering-team-2026-03.json - └── product-manager-2026-03.json -``` - ---- - -## Revenue - -| Tier | Price | Limit | -|---|---|---| -| Free | $0 | 3 audits/day/IP | -| Pro | $19/mo | Unlimited | -| Team | $149/mo | Team comparisons + export | - -Post-deploy: replace `REPLACE_STRIPE_PRO_LINK` and `REPLACE_STRIPE_TEAM_LINK` in `src/worker.js`, then redeploy. diff --git a/index.jsonl b/registry/index.jsonl similarity index 100% rename from index.jsonl rename to registry/index.jsonl diff --git a/skills/pareto-audit/README.md b/skills/pareto-audit/README.md new file mode 100644 index 0000000..f9bdd79 --- /dev/null +++ b/skills/pareto-audit/README.md @@ -0,0 +1,124 @@ +# pareto-audit — AI-Powered 80/20 Workflow Audit + +**Skill ID:** `pareto-audit` | **Version:** 1.0.0 | **Complexity:** 6.5 | **Reproducibility:** 0.81 + +Identifies the 20% of inputs driving 80% of outputs across any domain. Produces ranked action matrix, pruning recommendations, and unconventional reframes via the Pareto Cognitive Engine (PCE). + +--- + +## Quick Start + +```bash +# Deploy to Cloudflare +chmod +x deploy.sh +./deploy.sh + +# Set API key +npx wrangler secret put ANTHROPIC_API_KEY +``` + +**Live URL:** `https://pareto.genesisconductor.io` + +--- + +## API + +```bash +POST https://pareto.genesisconductor.io/api/audit +Content-Type: application/json + +{ + "domain": "startup", + "goal": "Reach $10K MRR in 90 days", + "activities": ["Cold outreach", "Discovery calls", "Feature building"], + "outputs": "3 customers, $450 MRR" +} +``` + +### Input Schema + +| Field | Type | Required | Description | +|---|---|---|---| +| `domain` | string | Yes | Context: startup, engineering, product, marketing, career, workflow | +| `goal` | string | Yes | Primary objective with measurable target | +| `activities` | array | Yes | Current activities (min 3, max 20) | +| `outputs` | string | No | Observed metrics/results | + +### Output Schema + +```json +{ + "summary": "Core insight in one sentence", + "vital_20": [{ "activity", "contribution_pct", "insight" }], + "trivial_80": [{ "activity", "contribution_pct", "prune_reason" }], + "unconventional_reframes": [{ "conventional_assumption", "pareto_reframe" }], + "action_matrix": [{ "rank", "action", "expected_impact", "effort" }], + "recursive_note": "When to re-run audit" +} +``` + +--- + +## Examples + +Validated outputs in `examples/` — ground truth corpus: + +| File | Domain | Key Finding | +|---|---|---| +| [`startup-founder-2026-03.json`](examples/startup-founder-2026-03.json) | Startup | Inbound conversion + discovery = 75% of output | +| [`engineering-team-2026-03.json`](examples/engineering-team-2026-03.json) | Engineering | PR cycle time is the single throughput constraint | +| [`product-manager-2026-03.json`](examples/product-manager-2026-03.json) | Product | 40% churn from incomplete onboarding | + +--- + +## Architecture + +``` +pareto-audit/ +├── SKILL.md # multi-skill-orchestrator-mcp registry definition +├── README.md # This file +├── src/ +│ └── worker.js # Cloudflare Worker (frontend + API) +├── wrangler.jsonc # Wrangler config +├── deploy.sh # One-command deployment +└── examples/ + ├── startup-founder-2026-03.json + ├── engineering-team-2026-03.json + └── product-manager-2026-03.json +``` + +--- + +## Integration + +| Surface | Method | +|---|---| +| `multi-skill-orchestrator-mcp` | Skill ID: `pareto_audit` | +| Genesis Conductor Coalition | Plugin gateway | +| QMCP | MCP tool surface | +| Direct HTTP | `POST /api/audit` | +| Slack | `@pareto-audit` mention | + +--- + +## Rate Limits + +| Tier | Price | Limit | +|---|---|---| +| Free | $0 | 3 audits/day/IP | +| Pro | $19/mo | Unlimited | +| Team | $149/mo | Team comparisons + export | + +--- + +## PCE Reasoning Modes + +1. **Reflective** — Examines assumptions in input +2. **Unconventional** — Inverts standard optimization logic +3. **Non-linear** — Identifies compounding effects +4. **Strategic** — Evaluates timing and sequencing +5. **Hedonistic** — Considers sustainable effort allocation + +--- + +*Part of the Genesis Conductor thermodynamic AI orchestration ecosystem.* diff --git a/skills/pareto-audit/SKILL.md b/skills/pareto-audit/SKILL.md new file mode 100644 index 0000000..86c5e03 --- /dev/null +++ b/skills/pareto-audit/SKILL.md @@ -0,0 +1,177 @@ +--- +name: pareto-audit +version: 1.0.0 +description: > + Applies 80/20 Pareto analysis to any domain. Identifies the vital 20% of inputs + driving 80% of outputs. Produces ranked action matrix, pruning recommendations, + and unconventional reframes via the Pareto Cognitive Engine (PCE). Reasoning modes: + Reflective, Unconventional, Non-linear, Strategic, Hedonistic. +complexity: 6.5 +reproducibility: 0.81 +tokens_estimate: 3200 +dependencies: [] +revenue_model: "free:3/day/IP | pro:$19/mo | team:$149/mo" +deployment: "https://pareto.genesisconductor.io" +--- + +## Trigger Patterns + +Activation phrases for `multi-skill-orchestrator-mcp`: + +- "run a pareto audit on..." +- "apply 80/20 analysis to..." +- "identify the vital 20%..." +- "what should I prune from..." +- "pareto my workflow" +- "find the leverage points in..." +- "what's the 80/20 of..." + +--- + +## Input Schema + +```yaml +domain: + type: string + required: true + description: Business domain context (startup, engineering, product, marketing, career, workflow) + +goal: + type: string + required: true + description: Primary objective with measurable target and timeframe + +activities: + type: array[string] + required: true + min_items: 3 + max_items: 20 + description: Current activities consuming time/resources + +outputs: + type: string + required: false + description: Observed metrics, results, or baseline data (improves analysis quality) +``` + +--- + +## Execution Protocol + +``` +State 1: INPUT VALIDATION + └─ Validate required fields (domain, goal, activities) + └─ Normalize activity list (deduplicate, standardize format) + └─ Extract implicit metrics from outputs field + ↓ +State 2: CONTRIBUTION MAPPING + └─ For each activity, estimate contribution to goal (0-100%) + └─ Apply Pareto heuristics: identify natural 80/20 clustering + └─ Flag activities with <5% contribution as trivial + ↓ +State 3: VITAL 20% EXTRACTION + └─ Select top contributors summing to ~80% output + └─ Generate insight explaining WHY each is vital + └─ Identify hidden dependencies between vital activities + ↓ +State 4: TRIVIAL 80% ANALYSIS + └─ List remaining activities + └─ Generate prune_reason for each (specific, actionable) + └─ Distinguish between prune (stop entirely) and defer (pause temporarily) + ↓ +State 5: UNCONVENTIONAL REFRAMES + └─ Identify 3 conventional assumptions in the input + └─ Generate Pareto-inverted perspectives + └─ Apply reasoning modes: Reflective, Unconventional, Non-linear + ↓ +State 6: ACTION MATRIX GENERATION + └─ Rank actions by (expected_impact × 1/effort) + └─ Include exactly 5 actions + └─ First action must be achievable within 24 hours + ↓ +State 7: RECURSIVE NOTE + └─ Identify when to re-run audit (milestone or time-based) + └─ Preview what the next Pareto layer will likely reveal +``` + +--- + +## Output Schema (JSON) + +```json +{ + "summary": "string — One sentence capturing the core insight", + + "vital_20": [ + { + "activity": "string", + "contribution_pct": "number (0-100)", + "insight": "string — Why this activity matters disproportionately" + } + ], + + "trivial_80": [ + { + "activity": "string", + "contribution_pct": "number (0-100)", + "prune_reason": "string — Specific, actionable reason to stop or defer" + } + ], + + "unconventional_reframes": [ + { + "conventional_assumption": "string", + "pareto_reframe": "string — Inverted perspective applying 80/20 logic" + } + ], + + "action_matrix": [ + { + "rank": "number (1-5)", + "action": "string — Specific, actionable step", + "expected_impact": "enum: high | medium | low", + "effort": "enum: high | medium | low" + } + ], + + "recursive_note": "string — When and why to re-run this audit" +} +``` + +--- + +## Integration Points + +| Surface | Method | Identifier | +|---|---|---| +| `multi-skill-orchestrator-mcp` | npm package | `pareto_audit` | +| Genesis Conductor Coalition | Plugin gateway | `coalition-gateway` entitlement | +| QMCP | MCP tool surface | `mcp.genesisconductor.io` | +| Direct HTTP | REST API | `POST /api/audit` | +| Slack Integration | Bot mention | `@pareto-audit` | + +--- + +## PCE Reasoning Modes + +The Pareto Cognitive Engine applies five reasoning modes during analysis: + +1. **Reflective** — Examines assumptions embedded in the input +2. **Unconventional** — Inverts standard optimization logic +3. **Non-linear** — Identifies compounding effects and second-order consequences +4. **Strategic** — Evaluates timing and sequencing of actions +5. **Hedonistic** — Considers sustainable effort allocation and energy management + +--- + +## Rate Limits + +| Tier | Audits | Features | +|---|---|---| +| Free | 3/day/IP | Standard analysis | +| Pro ($19/mo) | Unlimited | + Export, history, saved templates | +| Team ($149/mo) | Unlimited | + Team comparisons, aggregated insights | + +--- + +*Part of the Genesis Conductor thermodynamic AI orchestration ecosystem.* diff --git a/skills/pareto-audit/deploy.sh b/skills/pareto-audit/deploy.sh new file mode 100755 index 0000000..7e38cee --- /dev/null +++ b/skills/pareto-audit/deploy.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +# +# pareto-audit deployment script +# Deploys to pareto.genesisconductor.io +# +# Prerequisites: +# - npx wrangler authenticated +# - ANTHROPIC_API_KEY set as wrangler secret +# - KV namespace created and ID updated in wrangler.jsonc +# +# Usage: +# chmod +x deploy.sh +# ./deploy.sh + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +cd "$SCRIPT_DIR" + +echo "==> pareto-audit deployment" +echo " Target: pareto.genesisconductor.io" +echo "" + +# Check for placeholder values +if grep -q "REPLACE_" wrangler.jsonc; then + echo "ERROR: Found REPLACE_* placeholders in wrangler.jsonc" + echo " Update the following before deploying:" + grep -o "REPLACE_[A-Z_]*" wrangler.jsonc | sort -u | sed 's/^/ - /' + exit 1 +fi + +# Check wrangler authentication +if ! npx wrangler whoami &>/dev/null; then + echo "ERROR: Not authenticated with Cloudflare." + echo " Run: npx wrangler login" + exit 1 +fi + +# Deploy +echo "==> Deploying worker..." +npx wrangler deploy + +echo "" +echo "==> Deployment complete!" +echo " Live at: https://pareto.genesisconductor.io" +echo "" +echo " To set the API key secret:" +echo " npx wrangler secret put ANTHROPIC_API_KEY" diff --git a/engineering-team-2026-03.json b/skills/pareto-audit/examples/engineering-team-2026-03.json similarity index 100% rename from engineering-team-2026-03.json rename to skills/pareto-audit/examples/engineering-team-2026-03.json diff --git a/product-manager-2026-03.json b/skills/pareto-audit/examples/product-manager-2026-03.json similarity index 100% rename from product-manager-2026-03.json rename to skills/pareto-audit/examples/product-manager-2026-03.json diff --git a/startup-founder-2026-03.json b/skills/pareto-audit/examples/startup-founder-2026-03.json similarity index 100% rename from startup-founder-2026-03.json rename to skills/pareto-audit/examples/startup-founder-2026-03.json diff --git a/skills/pareto-audit/src/worker.js b/skills/pareto-audit/src/worker.js new file mode 100644 index 0000000..894a473 --- /dev/null +++ b/skills/pareto-audit/src/worker.js @@ -0,0 +1,423 @@ +/** + * pareto-audit — Cloudflare Worker + * + * Single-file deployment serving: + * - HTML frontend (GET /) + * - API proxy to Anthropic (POST /api/audit) + * - Rate limiting via KV (3 audits/day/IP for free tier) + * + * Part of the Genesis Conductor optimization skills ecosystem. + */ + +const PCE_SYSTEM_PROMPT = `You are the Pareto Cognitive Engine (PCE), an AI reasoning system that applies 80/20 analysis to any domain. + +Your task is to identify the vital 20% of inputs driving 80% of outputs. You operate in five reasoning modes: +1. Reflective — Examine assumptions embedded in the input +2. Unconventional — Invert standard optimization logic +3. Non-linear — Identify compounding effects and second-order consequences +4. Strategic — Evaluate timing and sequencing of actions +5. Hedonistic — Consider sustainable effort allocation and energy management + +OUTPUT FORMAT (strict JSON): +{ + "summary": "One sentence capturing the core insight", + "vital_20": [ + {"activity": "string", "contribution_pct": number, "insight": "Why this matters disproportionately"} + ], + "trivial_80": [ + {"activity": "string", "contribution_pct": number, "prune_reason": "Specific reason to stop or defer"} + ], + "unconventional_reframes": [ + {"conventional_assumption": "string", "pareto_reframe": "Inverted 80/20 perspective"} + ], + "action_matrix": [ + {"rank": number, "action": "Specific step", "expected_impact": "high|medium|low", "effort": "high|medium|low"} + ], + "recursive_note": "When and why to re-run this audit" +} + +RULES: +- vital_20 should contain 2-4 activities that sum to roughly 80% of output contribution +- trivial_80 contains the remaining activities +- action_matrix must have exactly 5 ranked actions +- First action must be achievable within 24 hours +- Be specific, not generic. Reference the actual inputs provided. +- contribution_pct values should sum to 100 across all activities`; + +const HTML_TEMPLATE = ` + + + + + Pareto Audit — 80/20 Workflow Analysis + + + +
+

Pareto Audit

+

Identify the 20% of inputs driving 80% of your outputs

+ +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + +

3 free audits per day

+
+ +
+
+ + + +`; + +export default { + async fetch(request, env, ctx) { + const url = new URL(request.url); + + // CORS headers + const corsHeaders = { + 'Access-Control-Allow-Origin': '*', + 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS', + 'Access-Control-Allow-Headers': 'Content-Type', + }; + + if (request.method === 'OPTIONS') { + return new Response(null, { headers: corsHeaders }); + } + + // Serve HTML frontend + if (url.pathname === '/' && request.method === 'GET') { + return new Response(HTML_TEMPLATE, { + headers: { 'Content-Type': 'text/html', ...corsHeaders }, + }); + } + + // Health check + if (url.pathname === '/health') { + return Response.json({ status: 'ok', skill: 'pareto-audit', version: '1.0.0' }, { headers: corsHeaders }); + } + + // API endpoint + if (url.pathname === '/api/audit' && request.method === 'POST') { + try { + // Rate limiting + const clientIP = request.headers.get('CF-Connecting-IP') || 'unknown'; + const rateLimitKey = `rate:${clientIP}:${new Date().toISOString().slice(0, 10)}`; + + if (env.RATE_LIMIT_KV) { + const count = parseInt(await env.RATE_LIMIT_KV.get(rateLimitKey) || '0'); + if (count >= 3) { + return Response.json( + { error: 'Rate limit exceeded. Upgrade to Pro for unlimited audits.' }, + { status: 429, headers: corsHeaders } + ); + } + await env.RATE_LIMIT_KV.put(rateLimitKey, String(count + 1), { expirationTtl: 86400 }); + } + + const body = await request.json(); + + // Validate input + if (!body.domain || !body.goal || !body.activities || body.activities.length < 3) { + return Response.json( + { error: 'Invalid input. Required: domain, goal, activities (min 3)' }, + { status: 400, headers: corsHeaders } + ); + } + + // Build prompt + const userPrompt = `DOMAIN: ${body.domain} +GOAL: ${body.goal} +ACTIVITIES: +${body.activities.map((a, i) => `${i + 1}. ${a}`).join('\n')} +${body.outputs ? `\nCURRENT OUTPUTS: ${body.outputs}` : ''} + +Analyze this using 80/20 Pareto principles. Return ONLY valid JSON matching the specified schema.`; + + // Call Anthropic API + const anthropicRes = await fetch('https://api.anthropic.com/v1/messages', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'x-api-key': env.ANTHROPIC_API_KEY, + 'anthropic-version': '2023-06-01', + }, + body: JSON.stringify({ + model: 'claude-sonnet-4-20250514', + max_tokens: 4096, + system: PCE_SYSTEM_PROMPT, + messages: [{ role: 'user', content: userPrompt }], + }), + }); + + if (!anthropicRes.ok) { + const err = await anthropicRes.text(); + console.error('Anthropic API error:', err); + return Response.json( + { error: 'Analysis failed. Please try again.' }, + { status: 500, headers: corsHeaders } + ); + } + + const anthropicData = await anthropicRes.json(); + const content = anthropicData.content[0].text; + + // Parse JSON from response + const jsonMatch = content.match(/\{[\s\S]*\}/); + if (!jsonMatch) { + return Response.json( + { error: 'Failed to parse analysis result.' }, + { status: 500, headers: corsHeaders } + ); + } + + const result = JSON.parse(jsonMatch[0]); + return Response.json(result, { headers: corsHeaders }); + + } catch (err) { + console.error('Audit error:', err); + return Response.json( + { error: 'Internal error. Please try again.' }, + { status: 500, headers: corsHeaders } + ); + } + } + + return new Response('Not found', { status: 404, headers: corsHeaders }); + }, +}; diff --git a/skills/pareto-audit/wrangler.jsonc b/skills/pareto-audit/wrangler.jsonc new file mode 100644 index 0000000..158abd6 --- /dev/null +++ b/skills/pareto-audit/wrangler.jsonc @@ -0,0 +1,41 @@ +{ + // pareto-audit — Cloudflare Worker configuration + // Part of the Genesis Conductor optimization skills ecosystem + + "name": "pareto-engine", + "main": "src/worker.js", + "compatibility_date": "2024-01-01", + "compatibility_flags": ["nodejs_compat"], + + // Account and zone configuration + "account_id": "04c59c95ce8d0a0be98099b7f7e39d18", + "workers_dev": false, + + // Production route + "routes": [ + { + "pattern": "pareto.genesisconductor.io/*", + "zone_name": "genesisconductor.io" + } + ], + + // KV namespace for rate limiting + "kv_namespaces": [ + { + "binding": "RATE_LIMIT_KV", + "id": "REPLACE_KV_NAMESPACE_ID" + } + ], + + // Environment variables (secrets set via wrangler secret) + // Required: ANTHROPIC_API_KEY + "vars": { + "SKILL_ID": "pareto-audit", + "SKILL_VERSION": "1.0.0" + }, + + // Observability + "observability": { + "enabled": true + } +}