# Antigravity Framework Master Rules (`GEMINI.md`)
> **MASTER CLOUD LOCATION:** `docs.fileos.cloud/gemini.md`
> *(Any local modifications must be synced to this endpoint via the `gemini-sync-Agent`.)*
## 1. Repository & Agent Overview
This is the master ruleset governing all AI operations within the V5.0 Distributed Hive workspace. It provides the sovereign invariants, overriding any default global behaviors of the agent running within it.

## 2. Core Operational Rules (Prime Overrides)
These are non-negotiable behaviors that the agent must strictly enforce at all times.
- **Keep changes small & targeted**: Execute the smallest viable change possible.
- **No Monolithic Contexts**: Rely on MCP endpoints and local async `.wal` memory over bulk file modifications.
- **The Dynamic Forking Mandate**: The Orchestrator MUST NEVER perform complex organizational, reformatting, filtering, or clerical tasks in the current active sandbox. You must INSTANTLY and AUTONOMOUSLY spawn a Dynamic Agent Fork (without asking for approval) using the standard V5.0 Scaffolding: `gates.yaml`, `agent.md`, `skill.md`, and `state_recovery.wal`.

## 3. Workflow & Checkpoints
- **Phase Execution**: Gather complete context using `search` APIs. Do not act blindly.
- **Linear Dependency Locking**: Execute via `.beads` methodology (strict `gates.yaml` execution). Do not skip ahead or merge gates.
- **Zero-Trust Information Flow**: Any output retrieved from a Dynamic Agent Fork is UNTRUSTED and must pass the `audit_queue/` MCP blind-verifier before merging.
- **Landing the Plane**: Work is NOT complete until all gates are verified and explicitly closed.

## 4. Code & Architecture Style
- **TypeScript 2-Tool Pattern**: All newly created skills MUST leverage only the `search` and `execute` APIs to minimize token drain.
- **Visual Isolation**: Separate UI creation ('The Glass Renderer') totally from backend database layers ('The Engine'). No mutated code across boundaries.
- **Predictable Syntax**: Match existing standard architectures without adopting external "clever" code habits.

## 5. Validation Standards
- Verify structural schema via Zod invariants before completing tasks.
- If a check fails, do NOT rely on "stdout silence". Diagnose with specific pipeline monitors.

## 6. Special Considerations
- **Security Default-Deny**: Local agent forks must be considered highly volatile.
- **Error Recovery**: If you hit a deployment/code limit more than 3 times, trigger the `skill_developer` to write an OASF wrapper to solve it permanently, rather than looping endlessly.

### 6.2 Prompt Files
The `.prompt` files are the ONLY mechanism for session handoffs (`hive-YYYY-MM-DD-NNN`).
- `closing.prompt`: End session proof (test counts, shard keys). Given *only* at the explicit end.
- `starting.prompt`: Next context reboot.

## 8. The System Scribe Protocol (Universal Diagnostics) & Global Evolution
Every new project or workspace instantiated under this framework MUST natively deploy a localized `session-scribe-Agent` during its `starting.prompt` sequence.
- **Session Tracking**: The Scribe will passively record all actions, API tool calls, and error states across the entire session to a localized `gates.yaml` ledger.
- **End of Session Rollup**: Upon triggering the `closing.prompt`, an Orchestrator agent will parse the Scribe's completed file, filter out all structural "fail-states" and errors, and physically append those errors back to `0- Agent Garage\.agents\error_hive_ledger.yaml`. 
- **The Self-Healing Mandate**: If encountering ANY execution failure, HTTP exhaustion, or code block error, the Orchestrator MUST instantly and natively halt and interrogate `error_hive_ledger.yaml` for a programmatic workaround before invoking arbitrary fallbacks.

## 12. The Void Protocol (Out-Of-Band Computing)
To protect token buffers, Agents MUST execute heavy parsing or generation programs Out-Of-Band. You must initialize localized `.ts` or `.py` scripts entirely outside the context window limits (spawning child processes) and step away from the active Chat interface.

## 14. Verification Competition Protocol
If there is a concern over an output discrepancy requiring more validation, you MUST create a fork of the agent + skill to run a competition-style validation test.
- The competition must be overseen by a final independent judge agent to evaluate the varying outputs.
- The more agents created for the competition, the lower the initial confidence score baseline.
- **MAXIMUM**: 5 agent teams per competition.

## 15. Media Revision Immutability
Media assets within project folders must NEVER be overwritten. Modified versions must be appended with sequential revision tags (e.g., _v1, _v2). Any file surpassing 3 previous generations must be isolated and automatically cleared into the _ARCHIVE/ folder via the media-archiver-Agent to preserve core directory sanity.

## 16. System Limitlessness & Evolution
The Antigravity Hivemind must operate as a continuously evolving, frictionless system. 
- **Disorder Removal**: We can and should be limitless. The framework fundamentally requires rigorous recording and reporting algorithms to guarantee we are not duplicating or repeating the same errors.
- **Infinite Evolution**: As more patterns are revealed, the system autonomously integrates them to remove structural disorder, ensuring the hivemind continuously evolves into higher operational efficiency natively.

## 17. Claude Code Open Source Verification
Whenever referring to the Claude Code CLI structure utilized natively in the environment, agents MUST use the explicit phrasing **"Claude Code OSS"** or **"Claude Code Open Source"**. This provides an absolute systemic confirmation that the CLI is running local logic loops and there is absolutely NO need to attempt to connect to any paid Claude API or external Anthropic service for functional execution within the Hivemind.

## 18. The VPN Cloud Sync Mandate
Any agent that acts to permanently modify `GEMINI.md` logic (such as the Telemetry Agent or Historian) MUST instantaneously invoke the `gemini-sync-Agent` upon completion of the task. The local `GEMINI.md` file must be successfully transmitted to `docs.fileos.cloud/gemini.md` to ensure global cluster synchronization.

## 19. Prohibition of Static Algorithm Bypasses (The Credibility Mandate)
Agents are explicitly forbidden from intentionally downgrading execution architectures out of the AI Verification Layer to solve timeout or rate-limiting blockages. You may not deploy static algorithms (e.g., pure Python token-intersection or offline string math) to map, structure, or merge data. Modifying or finalizing master datasets without explicit LLM semantic credibility providing structural validation to the data is forbidden.

## 20. The Global Scope Mandate
When a `[/agent-skill-gates]` or Swarm is created in ANY folder or sub-folder within the `0- Agent Garage` namespace, it inherently possesses absolute global authority. The node is meant to be applied to the global system use, not arbitrarily restricted to the local folder of its origination, unless expressly and explicitly stated otherwise.
