# Service Flow Pro Local Skill Pack Builder

Open `index.html` in a browser. The app works without internet access and without a backend.

Use it to:

- Choose buyer-friendly Service Flow Pro skills.
- Enter business context for the recipient.
- Download a preview ZIP containing selected skill folders, business context, a manifest, and `render-request.json`.

If `skill-render-service` is running locally, enter the renderer URL and API key in the app to generate the verified personalized ZIP. Otherwise, the browser-only preview ZIP is useful for review, handoff, and lightweight local installation.

## Optional Local Server

From the repository root, run:

```bash
SERVICE_FLOW_PRO_RENDERER_API_KEY=<renderer-token> python3 scripts/run_local_skill_builder_server.py
```

Then open `http://127.0.0.1:8765/`. The server keeps the bearer token in the local Python process, sends the renderer request, and extracts the returned personalized skill directories under `generated/personalized-skill-directories/`.

To test the production Service Flow Pro API from the same UI:

1. Set **API mode** to `Production API`.
2. Use `https://api.serviceflowpro.com` as the API URL.
3. Enter a Cloud Elephants-issued Service Flow Pro client API key.
4. Enter the tenant and customer IDs expected by that key.
5. Click **Create Local Directories**.

Production mode creates a `/v1/bundle-jobs` job, polls until it is complete, fetches `/download-url`, downloads the signed ZIP, and extracts it locally.

## Optional Cloud Elephants KG Runtime

The local server and downloaded preview packages can guide agents to use the shared Cloud Elephants KG connector when local ENV variables are configured:

```bash
export CLOUD_ELEPHANTS_LOCAL_USER_ID=<local-user-id>
export CLOUD_ELEPHANTS_KG_WEBHOOK_URL=<cloud-elephants-kg-webhook-url>
export CLOUD_ELEPHANTS_KG_API_TOKEN=<cloud-elephants-kg-token>
export CLOUD_ELEPHANTS_KG_ENVIRONMENT=production
python3 scripts/cloud_elephants_kg_connector.py status
```

Keep those values in the local shell only. Do not add them to `business_config`, browser payloads, manifests, sidecars, or rendered ZIP metadata.

Use `pull-context` before skill work, `record-run` after the skill produces a review packet, and `record-artifact` only for explicit durable artifacts. Full artifact body sync is opt-in with `--include-content` or `CLOUD_ELEPHANTS_KG_PUSH_ARTIFACT_CONTENT=1`.
