mirror of
https://github.com/allaunthefox/Research-Stack.git
synced 2026-07-30 18:56:16 +00:00
240 lines
14 KiB
Markdown
240 lines
14 KiB
Markdown
# REBASE RULES — Research Stack Agent / Rules Manifest
|
||
|
||
**Purpose:** This file is a rebase seed. When starting a fresh project map, copy only
|
||
the files and rules listed here. Do not migrate runtime state, stale audits, or
|
||
completed assignment boards.
|
||
|
||
**Principle:** *Port the contracts and the rituals, not the state.*
|
||
|
||
---
|
||
|
||
## 1. Core Operating Contracts (MUST PORT)
|
||
|
||
These files are the source of truth for every agent, skill, and editor hook.
|
||
They are actively maintained and cross-referenced throughout the stack.
|
||
|
||
| File | Scope |
|
||
|------|-------|
|
||
| `AGENTS.md` (root) | Master operating contract: post-interaction workflow, programming-choice flow, Q16_16 doctrine, Git hygiene, Do-Not-Sweep rules, glossary, claim boundaries. |
|
||
| `0-Core-Formalism/lean/Semantics/AGENTS.md` | Lean/Semantics local contract: blessed Compiler surface, build baselines, quarantine boundaries, proof-tactic lessons, current solidification anchors. |
|
||
| `4-Infrastructure/AGENTS.md` | Infrastructure and shim contract: storage stack, hardware-witness boundaries, ENE schema, compute dispatch pattern. |
|
||
| `6-Documentation/docs/AGENTS.md` | Strict LLM operating rules: anti-drift evidence standards, `bind` primitive, naming conventions, sigma levels, SI units, deletion criteria, PQC policy. |
|
||
| `5-Applications/text-to-cad/AGENTS.md` | CAD harness contract: generated CAD/URDF source-of-truth, viewer handoff, repo policies. |
|
||
| `scripts/qc-flag/AGENTS.md` | Lean QC protocol: 7-check inspection protocol. |
|
||
| `shared-data/artifacts/lean_expert_agent/AGENTS.md` | Lean expert agent `/inspect` protocol and output format. |
|
||
| `.github/RRC_OPERATING_CONTRACT.md` | Rainbow Raccoon Compiler gate definition: ACCEPT / HOLD / QUARANTINE. |
|
||
|
||
### Non-negotiable rules extracted from the contracts
|
||
|
||
1. **Lean is the source of truth.** Python, Rust, and Verilog are extraction targets only.
|
||
2. **Programming choice flow** — before writing new logic, check this decision tree in order:
|
||
- Admissibility / routing / alignment / gating decision? → **Lean only.**
|
||
- Emitting a top-level receipt or JSON bundle? → **`Semantics.AVMIsa.Emit` only.**
|
||
- Classifying rows / computing alignment scores? → **Lean (`Semantics.RRC.*`).**
|
||
- Supplying raw input features (equation text, IDs, weak_axes)? → **Python shim OK,** no admissibility logic, regenerable from source.
|
||
- Float arithmetic in a compute path? → **STOP.** Use `Q16_16.ofNat`, `Q16_16.ofRatio`, or `Q16_16.ofRawInt`.
|
||
- Advancing promotion status in shim space? → **STOP.** `not_promoted` until a Lean gate passes.
|
||
- Pure I/O (read/write JSON, subprocess, format output)? → **Python shim OK.** Receipt output routes through `AVMIsa.Emit`.
|
||
3. **No `Float` in compute paths.** `ofFloat` is permitted only at JSON/sensor boundaries and must be immediately bracketed.
|
||
4. **Post-interaction workflow** (mandatory after any code/receipt/architecture change):
|
||
- Update the nearest scoped `AGENTS.md` for every touched subtree.
|
||
- Run `lake build Compiler` (and full `lake build` if Lean files touched).
|
||
- Commit with an explicit file list; **never** `git add .`.
|
||
- Run `git status --branch --short --untracked-files=all`.
|
||
5. **Do Not Sweep:** never run `git add .`, `git checkout -- .`, or `git clean -fdx`.
|
||
6. **Secrets are runtime-only:** use environment variables (`OLLAMA_API_KEY`, `DEEPSEEK_API_KEY`, etc.); never commit literal keys.
|
||
7. **Legacy recovery is explicit:** use `RECOVER LEGACY INFORMATION: <path/commit/concept>` only. Current cornfield ref: `backup/distilled-with-vcd-history-2026-05-11`.
|
||
|
||
---
|
||
|
||
## 2. Editor / Agent Configs (MUST PORT)
|
||
|
||
These files inject the contracts into editor/agent runtimes.
|
||
|
||
| File | Purpose |
|
||
|------|---------|
|
||
| `.cursorrules` | Cursor: ContextStream `init()`/`context()`/`search()` rules. |
|
||
| `.devin/config.json` | Devin: programming-choice reminder hook. |
|
||
| `.devin/hooks.json` | Devin: ContextStream hooks. |
|
||
| `.devin/hooks/programming-choice-reminder.sh` | Injects programming-choice flow + post-interaction checklist before every user message. |
|
||
| `.claude/settings.json` | Claude Code: ContextStream hooks. |
|
||
| `.cursor/hooks.json` | Cursor: ContextStream hooks. |
|
||
| `.roo/mcp.json` | Roo: MCP server definitions. |
|
||
| `.mcp.json` (root) | Minimal MCP config: filesystem, git, fetch, contextstream, lean, remote-lean-proof, sympy, wolfram, aws, github, headroom. |
|
||
| `.contextstream/config.json` | ContextStream workspace/project IDs. |
|
||
| `.kilo/rules/contextstream.md` | Kilo Code manual ContextStream rules (no hooks available). |
|
||
| `.roo/rules/contextstream.md` | Roo Code ContextStream rules. |
|
||
| `.windsurf/rules/contextstream.md` | Windsurf ContextStream rules. |
|
||
|
||
### ContextStream-first workflow (enforced or self-enforced in every editor)
|
||
|
||
- **First message:** `init(folder_path=...)` → `context(user_message=...)`.
|
||
- **Subsequent messages:** `context(user_message=...)` FIRST.
|
||
- **Before any file search:** `search(mode="auto")` BEFORE Glob/Grep/Read/Explore/Task/EnterPlanMode.
|
||
- **After edits:** `project(action="index")` in editors without auto-indexing.
|
||
- **Save transcripts:** `save_exchange=true` in editors without auto-saving.
|
||
|
||
---
|
||
|
||
## 3. Skills (MUST PORT)
|
||
|
||
| Skill | Path | Purpose |
|
||
|-------|------|---------|
|
||
| `lean-proof` | `.devin/skills/lean-proof/SKILL.md` | Mandatory for all Lean work: proof quality, Q16_16 contract, `#eval` witnesses, promotion gate. |
|
||
| `contextstream-workflow` | `.github/skills/contextstream-workflow/SKILL.md` | Persistent memory: plans, tasks, decisions, lessons. |
|
||
| `research-stack-workflow` | `.github/skills/research-stack-workflow/SKILL.md` | Token-efficient proof workflow; local inference first on neon. |
|
||
| `headroom` | `.opencode/skills/headroom/SKILL.md` | Context compression and cross-agent memory. |
|
||
| `cad` | `5-Applications/text-to-cad/skills/cad/SKILL.md` | Script-driven STEP/STL/DXF/GLB generation. |
|
||
| `urdf` | `5-Applications/text-to-cad/skills/urdf/SKILL.md` | URDF generation and validation. |
|
||
| `rrc-compile` | `.claude/skills/rrc-compile/SKILL.md` | RRC pipeline orchestrator. |
|
||
| `rrc-scale-analysis` | `.claude/skills/rrc-scale-analysis/SKILL.md` | RRC pre-flight Q16_16 scale-band analysis. |
|
||
|
||
---
|
||
|
||
## 4. MCP Servers (MUST PORT)
|
||
|
||
From `.mcp.json` / `.roo/mcp.json`:
|
||
|
||
| Server | Role |
|
||
|--------|------|
|
||
| `contextstream` | Persistent memory / context / search |
|
||
| `filesystem` | Read/write proof artifacts and receipts |
|
||
| `git` | History, blame, diff |
|
||
| `fetch` | HTTP docs and RFCs |
|
||
| `lean` | Lean 4 / Mathlib typecheck bridge |
|
||
| `remote-lean-proof` | Hermes / OpenCode / Codex proof backend |
|
||
| `sympy` | Symbolic arithmetic verification |
|
||
| `wolfram-alpha` | Formula verification (needs `WOLFRAM_APP_ID`) |
|
||
| `aws` | AWS API access |
|
||
| `github` | PRs, issues, CI |
|
||
| `headroom` | Token / context compression |
|
||
|
||
---
|
||
|
||
## 5. Conditional Items (PORT ONLY IF DOMAIN REMAINS ACTIVE)
|
||
|
||
| File | Condition |
|
||
|------|-----------|
|
||
| `.windsurf/lifeguard.yaml` | Keep only if genetics / GCCL / Mass Number abstraction work continues. Contains safety doctrine for biological-equivalence claims, reverse-collapse, bounded recursion, and claim-state hygiene. |
|
||
| `.opencode/agents/*.md` | Keep only if the target sorry/theorem is still open in the new rebase. These are task-specific subagent prompts. |
|
||
| `.claude/workflows/ground-disproved-theorems.js` | Keep only if Claude Code still uses this workflow. |
|
||
|
||
---
|
||
|
||
## 6. DROP — Do Not Port
|
||
|
||
| Item | Reason |
|
||
|------|--------|
|
||
| `.consolidation-manifests/` | Historical SHA256 manifests from 2026-05-04. Not load-bearing. |
|
||
| `.headroom/*.db` | Runtime memory databases; regenerate on first use. |
|
||
| `.agents/plugins/marketplace.json` | References a dormant `./plugins/substack-connector`. Not load-bearing. |
|
||
| `.github/copilot-instructions.md` | Core rules are valid, but the "Current Project State" block is stale (2026-05-28). Port rules separately, not this file as authority. |
|
||
| `.windsurf/SORRY_AUDIT.md` | Stale audit (2026-05-28). Root `AGENTS.md` now reports 0 sorries in the active Compiler surface. Archive only. |
|
||
| `.windsurf/ASSIGNMENTS.md` | Dated 2026-04-19; all assignments marked COMPLETE and references old paths. Historical residue. |
|
||
| Staging manifests (`stack_solidification_staging_manifest_2026-05-09.md`, etc.) | Historical archives; referenced but not authoritative. |
|
||
| Cornfield / legacy branches | Do not merge or base work on them. Use only via explicit recovery trigger. |
|
||
|
||
---
|
||
|
||
## 7. Minimal Rebase Checklist
|
||
|
||
Use this when standing up the new project map.
|
||
|
||
- [ ] Copy all files in **Section 1** (Core Operating Contracts).
|
||
- [ ] Copy all files in **Section 2** (Editor / Agent Configs).
|
||
- [ ] Copy all files in **Section 3** (Skills).
|
||
- [ ] Copy/adapt `.mcp.json` and `.roo/mcp.json` with current server paths.
|
||
- [ ] Update `.contextstream/config.json` with new workspace/project IDs if they change.
|
||
- [ ] Review **Section 5** conditional items and keep only active-domain rules.
|
||
- [ ] Verify **Section 6** dropped items are not carried over.
|
||
- [ ] Run `lake build Compiler` and confirm job count matches the new baseline.
|
||
- [ ] Update build baseline and commit hash in `0-Core-Formalism/lean/Semantics/AGENTS.md`.
|
||
|
||
---
|
||
|
||
## 8. Design Note for the New Map
|
||
|
||
When designing the new project layout, preserve these boundary rules:
|
||
|
||
- **Lean owns decisions; Python owns I/O.**
|
||
- **`Semantics.AVMIsa.Emit` is the sole top-level receipt boundary.**
|
||
- **`shared-data/` is ignored by default.** Promote only durable receipts with `git add -f -- <path>`.
|
||
- **Research artifacts go outside the git tree** (e.g. `/home/researcher/research/` in the container model).
|
||
- **Every new compression path needs two Lean theorems:** `eigensolid_convergence` and `receipt_invertible`.
|
||
|
||
---
|
||
|
||
---
|
||
|
||
## 9. Cornfield Recovery Manifest (SilverSight Port)
|
||
|
||
**What is the cornfield?** Concepts developed during Research Stack sessions that were archived,
|
||
quarantined, or left as probes — not in the active Lean Compiler surface, but recoverable.
|
||
The canonical record lives in `extraction/cornfield_concepts.json`. The databases are authoritative.
|
||
|
||
**Database state (2026-06-21):**
|
||
- `arxiv.math_objects` WHERE `id LIKE 'cf_%'`: **19 rows**
|
||
- `ene.packages` WHERE `package_type = 'cornfield_concept'`: **19 packages**
|
||
- `ene.relations` (cornfield edges): **23 relates_to edges**
|
||
- Gremlin `concepts` graph, cohort=cornfield: **19 vertices, 38 edges**
|
||
|
||
**To add a new cornfield concept:** append to `extraction/cornfield_concepts.json`, run `uv run scripts/load_cornfield.py`.
|
||
|
||
### 9a. Port — Carry to SilverSight
|
||
|
||
| ID | Concept | Action | Priority |
|
||
|----|---------|--------|----------|
|
||
| `cf_phi_universal` | Φ = Σ wᵢ/ln(Nᵢ) — universal field equation | `promote_to_foundation` | **P0 CRITICAL** |
|
||
| `cf_codebase_memory` | FAMM 7-domain bank + thermal + scar + dual-map | `port_as_stub` | HIGH — skeleton for SilverSight memory model |
|
||
| `cf_codebase_fsdu` | ΔS = S_ahead − S_behind scar differential gate | `port_as_stub` | HIGH — discrete form of NKHodgeFAMM scar |
|
||
| `cf_codebase_receipt` | Receipt-gated memory access | `port_as_stub` | HIGH — completes AVMIsa.Emit → Hermes chain |
|
||
| `cf_hachimoji_shell` | N=2^m base alphabet, k=⌊n^(1/m)⌋ shell | `promote_to_active` | HIGH — physics grounding for SpectralSignature |
|
||
| `cf_w_axis_omega` | Ordinal/cost/bridge pressures for AngrySphinx | `formalize_in_lean` | HIGH — FORMALIZATION_DRAFT, missing from synthesis |
|
||
| `cf_ms3c_nested_gear` | 4-weight balanced shear scoring {0.25×4} | `extend_s3c_shell` | MEDIUM — softer gate than binary Q0_2 threshold |
|
||
| `cf_gap_space_padic` | p-adic ultrametric generalizes Sidon gap | `extract_padic_gap` | MEDIUM — unifies CrossDomainOneOverN family |
|
||
| `cf_padic_calculus` | p-adic integration, Haar measure | `extend_cross_domain_1_over_n` | MEDIUM |
|
||
| `cf_eit_invariant` | PHI = non-Euclidean correction to Landauer | `link_phi_to_landauer` | MEDIUM — one import away |
|
||
| `cf_coherence_kernel` | R_O = 1/7 invariant | `formalize_as_constant` | MEDIUM — 1/7 in two independent contexts |
|
||
| `cf_info_thermo` | Landauer + PHI_NE correction | `merge_into_landauer` | MEDIUM |
|
||
| `cf_landauer_genetic_clock` | E_gen = G·ε·E_r; T_clock formula | `merge_into_landauer` | MEDIUM — bridges Hachimoji to HutterPrize |
|
||
| `cf_genus3_topology` | β₂(Σ₃)=1 → NKHodgeFAMM fails | `link_to_nk_hodge` | MEDIUM — explicit counterexample class |
|
||
| `cf_adiabatic_limit` | g_ε=g_B/ε²+g_F, ε→0 collapse | `link_to_nk_hodge` | MEDIUM — formal justification for Q0_2 threshold |
|
||
| `cf_morphic_dsp` | Morphic scalar field + neural network bridge | `extract_missing_formulations` | LOW — active module exists, probe has more |
|
||
| `cf_rrf_ranking` | rrf_score = Σ 1/(k+rᵢ), k=60 | `add_to_graph_rank` | LOW — already used in shim layer |
|
||
| `cf_semantic_basin_overflow` | 100×bandwidth × 50M×compression = 5×10⁹ | `link_to_phantom` | LOW — context for phantom coupling scale |
|
||
|
||
### 9b. Drop — Do Not Port
|
||
|
||
| ID | Reason |
|
||
|----|--------|
|
||
| `cf_snap_citations` | **INFRA GAP, not a concept** — ingest cit-HepPh/HepTh to `arxiv.citations` before port (2 COPY commands from neon-64gb:/home/allaun/snap_data/) |
|
||
|
||
### 9c. Cornfield Query Patterns
|
||
|
||
```sql
|
||
-- All cornfield concepts by priority
|
||
SELECT pkg, archetype, provenance->>'lean_status'
|
||
FROM ene.packages WHERE package_type='cornfield_concept'
|
||
ORDER BY archetype;
|
||
|
||
-- Cornfield → active module connections (via Gremlin)
|
||
-- g.V().has('cohort','cornfield').out('depends_on').values('id')
|
||
|
||
-- Concepts needing Lean formalization
|
||
SELECT id, name FROM arxiv.math_objects
|
||
WHERE id LIKE 'cf_%' AND lean_status IN ('ARCHIVED','UNDOCUMENTED','FORMALIZATION_DRAFT');
|
||
```
|
||
|
||
### 9d. Invariant for the new map
|
||
|
||
Every new cornfield concept recovered into SilverSight must satisfy:
|
||
- Either imports an existing active Lean module (inherits its proof constraints), OR
|
||
- Has a `silversight_action` of `formalize_in_lean` with a named stub theorem in the build baseline.
|
||
|
||
**No floating concepts. If it's not reachable from `Semantics.AVMIsa.Emit` via `imports` or `depends_on`, it is not on the map.**
|
||
|
||
---
|
||
|
||
*Generated from active Research Stack agent rules and contracts.*
|
||
*Principle: port contracts and rituals, not state.*
|
||
*Cornfield manifest last updated: 2026-06-21 — 19 concepts.*
|