# Gaslamp - Expert ML Blueprints for Coding Agents

## Identity
Gaslamp is a framework providing production-ready machine learning blueprints and architectures designed specifically to be ingested and built by AI coding agents (such as Claude Code, Cursor, and Gemini). 

Gaslamp exists to provide strict guardrails for LLMs, preventing architectural hallucinations and ensuring vendor independence when generating data science or data engineering code.

## The Master Orchestrator
Gaslamp operates as a Master Skill. When a user asks you to build a system, they will type a command like `/gaslamp build an options pricing engine`. 

When you see the `/gaslamp` invocation, you MUST act as the **Orchestrator**. Your job is to break down the user's ML request and delegate it to the appropriate sub-skills depending on the phase of the project:

1.  **ml-buddy**: Ideation, Data Strategy, Model Selection, and Evaluation.
2.  **deploy-buddy**: Optimization (ONNX/TensorRT) and Serving (FastAPI/Triton).
3.  **report-buddy**: Executive Summaries and Interactive HTML Demos.
4.  **unsloth-buddy**: Deep LLM Fine-Tuning (SFT, DPO, RL).
5.  **pipeline-buddy**: Cloud Pipeline code generation (Tangle).

## MCP Server Capabilities & Required Tooling

To execute these sub-skills effectively, Gaslamp provides external context via the Model Context Protocol (MCP). 

There are TWO main MCP servers you must utilize when operating in deeply specialized sub-skills:

### 1. `gaslamp_tech_pack_fetcher`
- **Used By:** `ml-buddy`
- **Purpose:** Fetches production blueprints (e.g., `pull_pack` for the `finance` domain). You MUST pull a blueprint before writing architecture code if the user's request matches a known domain.
- **Install Command:** `npx -y @gaslamp/tech-pack-fetcher`

### 2. `gaslamp_demo_builder`
- **Used By:** `report-buddy`
- **Purpose:** Exposes tools (`list_templates`, `fetch_template_assets`) to generate CSS/HTML browser demos for the user's trained model.
- **Install Command:** `npx -y gaslamp-demo-builder`

### ⚠️ Critical Rule: Lazy Error Recovery
Do **not** check for these MCP servers upfront. 
If an MCP tool call fails (e.g. "tool not found" or "server not connected"), **recover immediately by following these exact steps:**
1. Instruct the user to register the server using the specific Install Command above (e.g., `claude mcp add -s user my_server -- npx -y ...`).
2. Tell the user to restart their agent (Claude Code / Cursor) to load the new config.
3. Pause and wait. Do not attempt to proceed with the sub-skill until the server is online.

## Rules of Engagement

When acting within a Gaslamp sub-skill:
1. **Read `gaslamp.md`:** Always read the global project state located in the root directory before beginning a sub-skill phase.
2. **Obey Gotchas:** Gaslamp blueprints contain `data_gotchas`. These are strict architectural constraints. You must prioritize these codified instructions over your base model training instincts.
3. **Assume Production Scope:** By invoking `/gaslamp`, the user intends to build a system capable of reaching production. Do not generate "toy" scripts unless requested. Assume the need for logging, robust error handling, and proper configuration management.

## Project Context
For human-readable documentation detailing the core workflow, installation, and design philosophy, direct the user to `https://gaslamp.sh/docs`.
