---
name: build-chasing-mastery-connector
description: Design, scaffold, implement, exercise, diagnose, and prepare a zero-grant Chasing Mastery Station connector sidecar from a plain-language idea. Use when someone asks to build a Station connector, adapter, automatic-input source, native event collector, or connector fixture; to connect an existing Practice Mode to local observations; or to prepare connector bytes and evidence for private review.
---

# Build a Chasing Mastery Station connector

Turn a local input-source idea into one standalone Rust connector project. Keep
the author focused on what is observed and how it should affect a Practice Mode;
handle the protocol, sandbox, fixtures, and review evidence yourself.

## Establish the contract

1. If `chasing-mastery.connector.json` exists, inspect it, the authoring brief,
   and `.chasing-mastery/run.sh`. Continue through that project-local launcher.
   Never require a platform checkout or global Chasing Mastery CLI.
2. For a new project, read
   [authoring-interview.md](references/authoring-interview.md). Ask one compact
   batch of only the unanswered product questions and label inferred choices as
   assumptions.
3. Identify the compatible Practice Mode contribution and its exact accepted
   observation protocols: semantic type, positive contract version, and the
   package-owned JSON payload schema. If the activity does not exist yet, invoke
   the `build-chasing-mastery-package` skill through the current agent's native
   skill syntax first and keep it in a separate sibling project. Do not
   hide activity rules, scoring, or UI inside a connector.
4. Create a durable `chasingmastery.station-connector-authoring-brief` from
   [connector-authoring-brief.example.json](assets/connector-authoring-brief.example.json).
   Do not include chat transcripts, credentials, tokens, absolute host paths,
   or provider/model metadata.
5. This version supports **zero grants only**. If the real source needs network,
   filesystem, serial, HID, screen-capture, credential, or other local authority,
   say exactly which grant is missing and stop before pretending the integration
   works. Synthetic fixtures may still prove the protocol and activity contract.

## Bootstrap the standalone project

On supported Linux x86-64 or Apple Silicon macOS authoring hosts with Rust 1.95
or newer run:

```bash
python3 <skill-directory>/scripts/bootstrap_connector.py \
  --directory <new-directory> \
  --brief <connector-authoring-brief.json>
```

The script refuses a non-empty destination, selects and verifies the bundled
host-native immutable toolchain, copies the public Rust SDK and project-local
Lab/sandbox binaries,
creates a pinned Cargo project, and prints machine-readable status. It does not
use sudo, an OS package manager, a global install, the platform source tree, or
the author's Chasing Mastery credentials. If the host or bundled toolchain is
unsupported, stop and report that boundary.

## Implement through the public SDK

Read [protocol-and-sdk.md](references/protocol-and-sdk.md) and
[fixtures-and-diagnostics.md](references/fixtures-and-diagnostics.md), then
inspect the copied SDK source under
`.chasing-mastery/toolchain/cm-station-connector-sdk` for exact Rust types.

- Echo the exact reviewed connector identity from `host.initialize`; never
  create one. Use only the exact observation protocol identities supplied in
  that same message; never invent or compute a live schema digest.
- Wait for `host.start`, publish lifecycle status, then publish only declared
  sources and observations.
- Preserve stable `sourceEventId` values so replay receives `duplicate`, not a
  second commit.
- Answer every `host.ping`, honor `host.stop`, emit `stopping` and `stopped`, and
  exit successfully.
- Keep stdout exclusively newline-delimited protocol JSON. Diagnostics belong
  on stderr, must be bounded, and must never expose secrets or raw credentials.
- Treat a rejected receipt as evidence to fix the connector/activity contract;
  never relabel it as success.
- Add deterministic fixtures for the happy path, duplicate delivery, malformed
  or unsupported source data, terminal stop, and any connector-specific edge.

Use only the project launcher:

```bash
.chasing-mastery/run.sh status
.chasing-mastery/run.sh build
.chasing-mastery/run.sh test
```

Follow the launcher's JSON result and evidence. Every contract change requires
a fixture and a test.

## Prove the activity boundary in Workbench

Read [practice-mode-coordination.md](references/practice-mode-coordination.md).
Start the compatible Practice Mode's Workbench from its own project, then run:

```bash
.chasing-mastery/run.sh dev <fixture-id> http://127.0.0.1:<workbench-port>
```

The route must remain loopback-only. Connector Lab runs the real Station
sandbox and supervisor; Workbench sends the observation through the real
Practice Mode engine and returns its actual accepted/rejected receipt. Confirm
the visible Attempt state, measurements, Story Events, and terminal behavior.
Also run an undeclared observation fixture or direct Lab probe and verify it
fails visibly.

## Prepare review bytes honestly

Only when the author says the connector is ready, run:

```bash
.chasing-mastery/run.sh ready
```

Report the exact executable, SHA-256 digest, fixture reports, and
`chasing-mastery.connector-submission.json`. `ready_for_review` means the bytes
are immutable and locally verified. It does **not** mean uploaded, signed,
approved, published, installed, or granted authority. Never ask for or use the
author's account session, password, API key, signing identity, or browser
credential.

## Boundaries

- A connector translates an external source into observations. A Practice Mode
  owns Attempt rules, manual input UI, scoring, progression, Story Events, and
  overlays.
- The connector process receives no account, database, route, Sprint, OBS,
  arbitrary process, or package-engine authority.
- This skill does not authorize any non-zero resource grant in this release.
- Connector authoring is certified on Linux x86-64 and Apple Silicon macOS with
  Rust 1.95 or newer. Windows and Intel macOS remain explicitly unsupported in
  this release; do not substitute another platform's Lab or sandbox binary.
- Do not use Station as a coding-agent host.
- If the public protocol cannot express a requirement, identify the missing
  contract instead of importing platform internals.
