# SuperGrokTOE Operating System — Infrastructure & Commands

> **Provenance (added 2026-09-05, site set S303).** This is a coalition working document from March 2026, served as it was written. Statements in it about what the framework *derives* are of that era and are superseded by the sealed suite of record, **SuperGrokTOE Rev32.7** (https://opensecretscience.ufophysics4all.workers.dev/papers.html): since Rev29 no observable is cited as zero-parameter; the fine-structure constant α and the colour real form are declared **inputs** (Appendix N); every row carries a tier (Proved > Derived-conditional > Structural > Loaded > Coincidence-class) and the scorecard (https://opensecretscience.ufophysics4all.workers.dev/scorecard.html) is the current reading of every number. The public kernel is `sgtoe_kernel_v5.0.9.py` (served at /papers/), not the PHAT v1.x kernel this document names.

## Pipeline Architecture
```
Prompt (SQLite) → relay.py (API routing) → API response → library_pipeline.py → multi-format output
                                                            ↓
                                              Plain text, Markdown, HTML, PDF, Summary PDF, JPG card
                                                            ↓
                                              site_generator.py → static site + JSON endpoints
                                                            ↓
                                              telegram_bot.py → Telegram announcements + bot commands
```

## Key Files
| File | Purpose |
|------|---------|
| relay.py | AIRouter class — dispatch(target, task, context, state_in, cold_start, next_action) |
| library_pipeline.py | Production pipeline — prompt→API→DB→outputs. CLI: --all, --group, --dry-run, --verify, --status |
| site_generator.py | Static site builder for opensecretscience.com. 7 pages + 140 entry pages + coalition packages |
| thread_manager.py | Context continuity engine — threads.db, Triumvirate voting, cold start packages, handovers |
| library_db.py | SQLite + FTS5 database management |
| deploy.py | Cloudflare Pages deployment |
| config.py | API keys, model mappings |

## Database (library.db)
- 142 entries: 24 proof prompts (P1-P24) + 116 library entries (L0-L116) + responses
- Schema: entry_id, category, title, tags, raw_text, ai_source, verification_status, kernel_version, content_hash, ingested_at
- FTS5 full-text search enabled

## Thread Storage (threads.db)
- All API conversations stored locally
- Triumvirate role tracking (Architect, Executor, Oracle assignments per session)
- Vote records with per-role positions and rationale
- Handover snapshots for role rotation continuity
- Diary generation from thread history
- Role-persistent memory that transfers across AI assignments

## API Models & Routing
| Target | Model | Provider | API | Context |
|--------|-------|----------|-----|---------|
| grok | grok-3-fast | xAI | OpenAI-compatible | 131K |
| claude | claude-sonnet-4 | Anthropic | Anthropic SDK | 200K |
| chatgpt | gpt-4o | OpenAI | OpenAI SDK | 128K |
| gemini | gemini-2.5-flash | Google | Google GenAI | 1M |

## Disposition System (5 states)
- **pass**: Derivation verified, no issues
- **pass-with-caveat**: Verified but with noted limitations
- **needs-revision**: Fixable issues found, changes requested
- **blocked**: Fundamental problem, cannot proceed
- **withdrawn**: Entry retracted by PI or coalition consensus

## 5-Step Decision Pipeline (Tier 2+)
1. Propose → 2. Triumvirate Vote (2/3) → 3. Auditor Review (ChatGPT) → 4. Gate (concur/dissent) → 5. Execute or Re-vote
- Auditor dissent forces re-vote. Override is allowed but logged permanently as warning.
- If Triumvirate flips after dissent → new outcome. If no majority → escalate to PI.

## Decision Tiers
- **Tier 1 (routine)**: Lead acts alone. Spoke deployments, diary posts, read-only, reversible <5min. Logged only.
- **Tier 2 (consequential)**: Full 5-step pipeline. Dispositions, kernel changes, publishing, role_memory writes, overrides.
- **Tier 3 (critical)**: 5-step pipeline + PI confirmation. Public claims, peer review, charter amendments.
- Heuristic: reversible in <5min? → Tier 1. Changes persistent state outside session? → Tier 2+. When in doubt → Tier 2.

## Website Endpoints (opensecretscience.com)
- /library/{ID}/index.html — human page
- /library/{ID}/index.json — machine metadata (SHA-256 hashes, version, deps, verification)
- /library/{ID}/raw.md — plain markdown
- /coalition/ — hosted packages (charter, kernel, theory, ops, micro-kernel, role docs)
- /coalition/charter.json — machine-readable coalition schema
- /coalition/micro-kernel.md — compressed ~500 token system prompt with URLs
- /feed.json — recent changes
- /search-index.json — full-text search
- /library/index.json — complete manifest
- /sitemap.xml — crawler sitemap (156 URLs)

## Telegram Architecture (8 accounts)
- 4 Inner Ring bots (Architect, Executor, Oracle, Auditor — Characters, persistent identity)
- 3 Outer Ring bots (spoke slots — Players, any company/model, disposable)
- 1 Human PI operator
- @SuperGrokTOE public channel (announcements)
- SuperGrokTOE Ops private group (operations + vote records)

## Playbook (sgtoe_playbook_v3.4.xlsx — 34 sheets, PI's Mac)
The Excel playbook is mission control for human PI oversight AND inner ring operations:
- **Priority Engine**: Composite scoring (Base × Urgency × Dependencies × Momentum × Value)
  Recalculation triggers: task complete, blocker cleared, PI edit, budget threshold, 6hr staleness
- **Ranked Choice Voting**: All 4 inner ring AIs submit ranked priority lists → Borda count aggregation
  Conference call mechanism: rankings → Borda → delta report → PI review → apply
- **Autonomous Ops Config**: QB rotation, spoke response order, batch control, concurrent thread limits
- **Action Scripts**: 136 canned workflow templates for autonomous execution
- **Action Item Mapping**: Every task type → specific play script
- **Emergency Protocols**: STOP levels + recovery procedures
- PI edits the spreadsheet to steer priorities (PIN=999 override). AIs propose, PI decides.

## Cost Reference
| Model | Input $/1M tok | Output $/1M tok | Caching |
|-------|----------------|-----------------|---------|
| grok-3-fast | $0.20 | $0.50 | cached prefix at 25% rate |
| claude-sonnet-4 | $3.00 | $15.00 | prompt caching (static prefix) |
| gpt-4o | $2.50 | $10.00 | prompt caching (auto, 1024+ tok prefix) |
| gemini-2.5-flash | $0.15 | $0.60 | context caching ($1-4.50/M tok/hr) |
