scbe-training-pipeline
Manage the SCBE SFT training data pipeline — merge sources, validate quality, track corpus statistics, generate new SFT pairs from codebase, trigger training runs, and push to HuggingFace. Use when working with training data, SFT generation, data quality, or model fine-tuning.
Best use case
scbe-training-pipeline is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Manage the SCBE SFT training data pipeline — merge sources, validate quality, track corpus statistics, generate new SFT pairs from codebase, trigger training runs, and push to HuggingFace. Use when working with training data, SFT generation, data quality, or model fine-tuning.
Teams using scbe-training-pipeline should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/scbe-training-pipeline/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How scbe-training-pipeline Compares
| Feature / Agent | scbe-training-pipeline | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Manage the SCBE SFT training data pipeline — merge sources, validate quality, track corpus statistics, generate new SFT pairs from codebase, trigger training runs, and push to HuggingFace. Use when working with training data, SFT generation, data quality, or model fine-tuning.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# SCBE Training Pipeline
End-to-end management of the Ouroboros training loop: codebase -> SFT data -> model training -> governance -> codebase.
## The Ouroboros Loop
```
Codebase (docs, tests, specs)
|
v
SFT Generation (scripts/generate_*.py)
|
v
Merge & Dedup (scripts/merge_and_upload.py)
|
v
Quality Gates (min length, legacy quota, track balance)
|
v
Upload to HuggingFace (issdandavis/scbe-aethermoore-training-data)
|
v
Fine-tune Model (3 specialty heads)
|
v
Model governs Codebase -> repeat
```
## SFT Source Files
Located in `training-data/`:
| Source | Content |
|--------|---------|
| `instruction-tuning/scbe_instructions.jsonl` | Core architecture Q&A |
| `knowledge-base/system_knowledge.jsonl` | System knowledge base |
| `knowledge-base/crypto_knowledge.jsonl` | Cryptography knowledge |
| `sft_notion.jsonl` | Notion export conversions |
| `sft_spiralverse.jsonl` | Spiralverse lore/canon |
| `sft_iseki.jsonl` | Iseki narrative data |
| `sft_kernel_manifest.jsonl` | Kernel manifest entries |
| `sft_codebase.jsonl` | Self-referential codebase docs |
| `sft_ouroboros.jsonl` | Ouroboros loop data |
| `sft_hydra_arch.jsonl` | HYDRA architecture data |
## Pipeline Operations
### 1. Merge All Sources
```bash
python scripts/merge_and_upload.py
```
- Loads all JSONL sources
- Deduplicates by instruction text
- Enriches metadata (track, source_type, quality)
- Applies legacy quota (max 15% legacy docstrings)
- Filters short responses (< 50 chars)
- Writes `sft_combined.jsonl` + `sft_combined_chat.jsonl`
- Splits into track files: `sft_system.jsonl`, `sft_governance.jsonl`, `sft_functions.jsonl`
### 2. Quality Validation
Check corpus health:
```python
# Track balance (aim for roughly equal)
tracks = {"system": N, "governance": N, "functions": N}
# Legacy ratio (should be <= 15%)
legacy_ratio = legacy_count / total_count
# Response quality metrics
avg_response_length # aim for > 200 chars
min_response_length # floor at 50 chars
dedup_ratio # unique / total
```
### 3. Generate New SFT Pairs
When new code is written, generate SFT pairs from it:
```python
# For each new/modified Python file:
# 1. Extract docstrings, class/function signatures
# 2. Generate instruction: "What does {function_name} do?"
# 3. Generate response from docstring + code analysis
# 4. Tag with metadata: source_file, track, source_type
```
### 4. Upload to HuggingFace
```bash
python scripts/merge_and_upload.py --upload --repo-id issdandavis/scbe-aethermoore-training-data
```
### 5. Trigger Training Run
```bash
# Local 3-specialty training
python training/train_node_fleet_three_specialty.py \
--epochs 12 \
--embedding-dim 320 \
--push-to-hub
# Federated artifact fusion
python training/federated_orchestrator.py \
--manifests training/manifests/*.json \
--output training/fused_release.json
```
### 6. Corpus Stats
Track these metrics over time:
- Total records, records per track, records per category
- Average response length, instruction diversity
- Legacy share percentage
- Deduplication ratio
- Category coverage (all 14 layers represented?)
## Training Tracks
| Track | Focus | Target Agent Role |
|-------|-------|-------------------|
| system | Architecture, math, narrative | LEADER |
| governance | Policy, safety, risk, FSGS | VALIDATOR |
| functions | Code, crypto, implementation | EXECUTOR |
## Key Files
| File | Purpose |
|------|---------|
| `scripts/merge_and_upload.py` | Main merge + upload pipeline |
| `training/train_node_fleet_three_specialty.py` | 3-head specialty training |
| `training/federated_orchestrator.py` | Multi-cloud artifact fusion |
| `training/doc_verifier.py` | Documentation verification |
| `training/kernel_manifest.py` | Kernel manifest generation |
| `training-data/` | All SFT source files |
## Quality Gates (from federated_orchestrator.py)
```python
Gates(
min_quality=0.80,
min_safety=0.95,
max_latency_ms_p95=200,
max_cost_per_1k_tokens=1.0,
)
```
## SFT Pairs from SaaS/Billing API Interactions
Every API call through the SaaS routes (`src/api/saas_routes.py`) is a natural source of training data. The request/response pairs demonstrate real usage patterns, governance decisions, and error handling.
### What to Capture
| API Endpoint | SFT Instruction Pattern | Track |
|-------------|------------------------|-------|
| `POST /saas/tenants` | "How do I provision a new tenant with plan X?" | system |
| `POST /saas/flocks` | "Create a flock with N agents for task Y" | functions |
| `POST /saas/flocks/{id}/governance` | "Evaluate this payload against governance rules" | governance |
| `GET /saas/flocks/{id}/metrics` | "What are the current metrics for flock X?" | system |
| `POST /saas/audit-report` | "Generate an audit report for tenant X" | governance |
| Error responses (401, 403, 429) | "What happens when rate limit / auth fails?" | governance |
### Generation Pattern
```python
import json
from datetime import datetime
def api_call_to_sft(method: str, path: str, request_body: dict, response_body: dict, status: int) -> dict:
"""Convert an API request/response pair into an SFT training record."""
if status < 400:
instruction = f"Using the SCBE SaaS API, {method} {path} with the following parameters: {json.dumps(request_body, indent=2)}"
response = f"The API responds with status {status}:\n```json\n{json.dumps(response_body, indent=2)}\n```"
else:
instruction = f"What happens when you call {method} {path} with invalid or unauthorized parameters?"
response = f"The API returns status {status} with error: {json.dumps(response_body)}"
return {
"instruction": instruction,
"response": response,
"metadata": {
"source_type": "api_interaction",
"track": "governance" if "governance" in path or status >= 400 else "functions",
"endpoint": f"{method} {path}",
"status_code": status,
"generated_at": datetime.utcnow().isoformat(),
}
}
```
### Integration Points
1. **Middleware logger**: Add a FastAPI middleware that captures request/response pairs to a JSONL file at `training-data/sft_api_interactions.jsonl`.
2. **Merge pipeline**: Add `sft_api_interactions.jsonl` as a source in `scripts/merge_and_upload.py`.
3. **Governance-heavy data**: Error responses (auth failures, rate limits, plan violations) are high-value governance training data -- weight them 2x in the merge.
4. **Metering data**: The `MeteringStore` counters (`GOVERNANCE_EVALUATIONS`, `WORKFLOW_EXECUTIONS`, `AUDIT_REPORT_GENERATIONS`) provide aggregate stats for system-level SFT pairs.
### Privacy and Safety
- Strip API keys and tenant identifiers before writing SFT records.
- Replace real tenant names with synthetic placeholders (e.g., `tenant_alpha`, `tenant_beta`).
- Never include raw request headers in training data.
- Run governance scan on generated SFT pairs before merging into the corpus.Related Skills
scbe-training-pair-authoring
Create prompt and response and metadata training pairs from SCBE documents, repair traces, terminal sessions, and operational workflows using the repository's canonical dataset contract and provenance rules.
scbe-spin-conversation-engine
Generate SFT training data via radial matrix conversation pivots with D&D-style combat research mode. Produces diverse, cost-effective training pairs with Sacred Tongue encoding, golden spiral problem distribution, and harmonic re-attunement.
scbe-research-training-bridge
Stage arXiv evidence and Obsidian markdown into source-grounded Hugging Face training bundles for research, review, and later SFT runs.
scbe-document-management
Consolidate overlapping docs, classify files by authority, and keep SCBE repo documents aligned with runtime truth. Use when the repo has drift between canonical docs, public docs, proposal notes, research branches, and generated evidence.
scbe-colab-bridge
Control Google Colab notebooks from Claude Code via Chrome extension. Execute cells, run terminal commands, read outputs, and manage GPU compute remotely.
scbe-claim-to-code-evidence
Map SCBE Notion technical claims, proof pages, and patent-facing architecture notes to concrete repository evidence such as code paths, tests, demos, and docs. Use when Codex needs to build a due-diligence packet, claim-to-code audit, implementation crosswalk, patent support note, or proof summary from local Notion exports and repo artifacts.
scbe-autonomous-worker-productizer
Turn SCBE automation, autonomous worker, and revenue-system notes into concrete offers, workflow packs, pilot plans, or SaaS-facing product packets. Use when Codex needs to package Notion automation pages into buyer-ready offerings, n8n/Zapier workflow designs, flock-backed worker systems, or implementation roadmaps tied to existing SCBE repo surfaces.
scbe-code-scanning-ops
Operate GitHub code scanning and CodeQL remediation for SCBE repositories. Use when triaging code-scanning alerts, mapping alert classes to fix patterns, validating targeted regressions, or wiring dedicated CodeQL workflows and runbooks into the repo.
scbe-world-anvil-lore-rag-7th-tongue
Build and operate a lore-focused RAG system using World Anvil exports and SCBE docs, with deterministic Claude/Codex cross-talk packets for handoff. Use when users ask to structure lore canon retrieval, sync worldbuilding data, enforce citation-grounded generation, or coordinate a 7th Tongue overseer lane across multiple AI agents.
scbe-webtoon-book-conversion
Convert The Six Tongues Protocol and related manuscript sections into webtoon/manhwa storyboard packets, episode roadmaps, panel expansion plans, and image-generation-ready prompt lanes. Use when extending the series storyboard, adapting book chapters into vertical scroll episodes, or keeping art generation tied to canon instead of drifting into generic fantasy panels.
scbe-voice-render-verification
Govern and verify SCBE voice rendering work that maps Langues weighting into breath, phase, and Layer 14 audio-axis packets. Use when implementing or reviewing `scripts/voice_gen_hf.py`, emitting sidecar voice packets, validating canonical tongue ordering, tuning breath planning or phase timing, or keeping voice docs and code aligned with `docs/LANGUES_WEIGHTING_SYSTEM.md` and `docs/specs/SCBE_VOICE_EMOTIONAL_TIMBRE_SYSTEM.md`.
scbe-universal-synthesis
Orchestrate all installed Codex skills through an auto-updating synthesis matrix with Sacred Tongues routing, emotion/intent metadata, and decodable lexicon packets tied to established SCBE characters. Use when the user asks for cross-skill coordination, auto skill updates, multi-skill routing, or Sacred Tongues intent mapping.