Skip to main content

Opinionated AI agent orchestration framework for Gemini CLI and Antigravity

Project description

Gemstack

Opinionated AI agent orchestration framework for Gemini CLI and Antigravity.

PyPI Python CI License Typed

Gemstack gives your Gemini-powered agents architectural memory, topology-aware guardrails, and a 5-step lifecycle that forces them to verify their own work against your terminal โ€” not just hallucinate a solution and tell you it's done.

Built for Gemini CLI and Google Antigravity. Also works with Cursor, Claude Desktop, and Cline via MCP.


The Problem

Every AI coding tool on the market today โ€” Cursor, Copilot, Aider, Cline โ€” is bottom-up. You highlight a file, say "write this function," and the agent does its best. Here's what goes wrong at scale:

  • ๐Ÿง  Architecture amnesia โ€” The agent forgets your tech stack, reinvents design patterns, and introduces conflicting libraries across sessions.
  • ๐Ÿ” Silent rewrites โ€” It overwrites perfectly good files to suit new logic, mutating critical path variables without testing.
  • โœ… Self-reported success โ€” It tells you "Done!" but never actually ran the test suite. You discover failures 3 commits later.
  • ๐ŸŽญ One-size-fits-all prompting โ€” A React SPA and a Go microservice get the same generic instructions. No guardrails for your specific topology.

The Solution

Gemstack is top-down. It acts as the orchestrator above your editor, purpose-built for Gemini CLI and Google Antigravity โ€” Google's agentic AI coding platforms. Gemstack gives your Gemini agent the exact context, constraints, and verification loops it needs to produce production-quality code.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                          GEMSTACK                             โ”‚
โ”‚                                                               โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚   โ”‚ Context  โ”‚  โ”‚  Topology  โ”‚  โ”‚  Phase  โ”‚  โ”‚ Autonomous โ”‚   โ”‚
โ”‚   โ”‚ Compiler โ”‚โ”€โ–ถโ”‚ Guardrails โ”‚โ”€โ–ถโ”‚ Router  โ”‚โ”€โ–ถโ”‚  Executor  โ”‚   โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ”‚        โ”‚                                           โ”‚          โ”‚
โ”‚   .agent/ files                        Terminal verification  โ”‚
โ”‚   (ARCHITECTURE, STYLE,              (Exit Code 0 or retry)   โ”‚
โ”‚    TESTING, STATUS)                                           โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ†•                  โ†•                    โ†•
     Gemini CLI         Antigravity      Cursor / Claude / Cline
      (native)           (native)          (via MCP Server)

Gemstack's workflows install as slash commands (/architect, /step1-spec, /step3-build, etc.) directly into Gemini CLI and Antigravity. When you type /step3-build in a new Antigravity conversation, the full compiled context โ€” roles, phases, topology guardrails, and your project's .agent/ files โ€” is loaded automatically. For other AI IDEs, the built-in MCP server provides the same capabilities.


Key Features

๐Ÿ›๏ธ Architectural Memory via .agent/ Files

Define your entire project context once โ€” tech stack, API contracts, database schemas, coding style, test strategy, and anti-patterns โ€” in 5 structured markdown files. Every AI agent reads these before touching your code. No more repeating yourself across sessions.

gemstack init --ai    # AI analyzes your codebase and auto-populates .agent/

๐Ÿ”„ The 5-Step Verified Lifecycle

Every feature flows through Spec โ†’ Trap โ†’ Build โ†’ Audit โ†’ Ship, with each step running in a fresh context window. The Auditor can't be influenced by the Builder's justifications. Tests are written before code. This is how you crush hallucination.

Step 1: Spec  โ†’ Define the feature, lock API contracts    (Product Visionary + Architect)
Step 2: Trap  โ†’ Write the failing test suite + task plan  (SDET + Planner)
Step 3: Build โ†’ Implement until Exit Code 0               (Principal Engineer)
Step 4: Audit โ†’ Fresh-eyes security & logic review        (Security Engineer)
Step 5: Ship  โ†’ Integrate, merge, deploy, archive         (DevOps Engineer)

๐Ÿ“ Topology-Aware Guardrails

Instead of generic prompts, Gemstack loads domain-specific guardrails based on your project's detected topology. A Next.js app with a Go backend gets different rules than a Python ML pipeline.

Topology Example Guardrails
Backend Deterministic test discipline, anti-mocking rules, N+1 query detection
Frontend Component state coverage matrix (empty/loading/success/error), hydration safety
ML/AI Evaluation-Driven Development, cost circuit breakers, prompt versioning
Infrastructure YAML validation, no-auto-apply policy, configuration drift detection
Library/SDK API surface snapshot diffing, semver enforcement, backward compatibility

๐Ÿค– Autonomous Execution with gemstack run

Go beyond copy-pasting prompts. Gemstack compiles your full project context, calls Gemini, writes the results to disk, and tracks costs โ€” all in a single command:

gemstack run step1-spec --feature "Add user notifications"   # Define the spec
gemstack run step3-build --feature "Add user notifications"  # Build until tests pass
gemstack run step4-audit --feature "Add user notifications"  # Fresh-context audit

Each execution includes: per-project lockfile (prevents concurrent corruption), cost tracking with configurable circuit breakers, path traversal prevention on AI-generated file writes, and structured result summaries.

๐Ÿ”Œ Native IDE Integration via MCP

Gemstack exposes your .agent/ context to any MCP-compatible agent (Cursor, Claude Desktop, Gemini CLI, Cline) as a Model Context Protocol server โ€” with read-only resources, actionable tools, and reusable prompt templates:

gemstack mcp serve                           # Start stdio server
gemstack mcp register --cursor --claude-desktop  # Auto-register with your IDEs

Exposed MCP tools: gemstack_status, gemstack_route, gemstack_compile, gemstack_check, gemstack_diff, gemstack_run, gemstack_costs

๐Ÿงฉ Extensible Plugin System

Add custom topologies, roles, validation checks, or intercept compilation events with the stable pluggy-based plugin API (backward-compatible through the 1.x series):

from gemstack.plugins.hooks import hookimpl

class MobilePlugin:
    @hookimpl
    def gemstack_register_topologies(self):
        return [{"name": "mobile", "description": "iOS/Android", "content": "..."}]

    @hookimpl
    def gemstack_post_init(self, project_root, profile):
        (project_root / ".agent" / "MOBILE.md").write_text("# Mobile Context")

๐Ÿ” Context Drift Detection

Catch when your codebase drifts from what's documented. Gemstack compares your actual dependencies, environment variables, and file references against your .agent/ context:

gemstack diff    # Detect new deps, removed env vars, stale file refs
gemstack check   # Validate .agent/ directory integrity

๐Ÿ“Š 28 CLI Commands Across 7 Categories

Category Commands Purpose
Setup init, install, uninstall, doctor, config Project bootstrapping, CLI registration, environment validation
Workflow status, route, start, phase, run Lifecycle management, autonomous execution
Context compile, diff, export, snapshot, migrate Prompt compilation, drift detection, format exports
Analysis check, compare, replay, matrix Validation, benchmarking, retrospectives, cross-project dashboards
Tooling mcp, hook, worktree, ci, scaffold MCP server, git hooks, parallel worktrees, CI generation
ML/AI prompt, eval Prompt template versioning, evaluation runner with holdout boundary
DX tail, teach Live TUI dashboard, interactive tutorial

Quickstart

# 1. Install (with AI bootstrapping + MCP server support)
pipx install "gemstack[ai,mcp]"

# 2. Initialize your project (AI auto-detects stack, topology, and commands)
cd your-project/
gemstack init --ai

# 3. See your current lifecycle state
gemstack status

# 4. Get the recommended next action
gemstack route

# 5. Start a new feature lifecycle
gemstack start "Add user search"

# 6. Execute Step 1 autonomously via Gemini
gemstack run step1-spec --feature "Add user search"

Alternative Install Methods

uv tool install "gemstack[all]"          # uv (fastest)
pip install "gemstack[all]"              # Standard pip
pipx install gemstack                    # Minimal (no AI, no MCP)

How It Works: The Context Compiler

The Context Compiler is the engine that makes Gemstack work. When you run a workflow step, it performs JIT (Just-In-Time) prompt assembly:

  1. Parses the workflow โ€” Extracts required roles and phases from the step definition
  2. Loads role definitions โ€” Bundles expert personas (Architect, SDET, Security Engineer, etc.)
  3. Loads phase instructions โ€” Attaches phase-specific behavioral rules (Ideate, Design, Build, etc.)
  4. Applies topology guardrails โ€” Detects your project topology from ARCHITECTURE.md and injects domain-specific constraints
  5. Compiles .agent/ context โ€” Reads your project's architecture, style, testing, and status files
  6. Includes relevant source files โ€” Pulls in files referenced in STATUS.md
  7. Fires plugin hooks โ€” Lets plugins modify sections before/after compilation
  8. Applies token budgeting โ€” Truncates lowest-priority sections first if you exceed your context window
gemstack compile step3-build                   # View the full compiled prompt
gemstack compile step3-build --token-budget 100000  # With token limits

Compatibility

Supported
Python 3.10, 3.11, 3.12, 3.13
OS macOS, Linux, Windows (WSL)
AI Backend Google Gemini (via google-genai)
MCP Transport stdio, SSE
Project Languages TypeScript/JavaScript, Python, Go, Rust (auto-detected)
Package Managers npm, pnpm, yarn, bun, pip, uv, poetry, cargo, go mod

Documentation

๐Ÿ“š Getting Started Installation, initialization, and your first workflow
โš™๏ธ The .agent/ Context System How the 5 context files drive AI behavior
๐Ÿ”„ The 5-Step Lifecycle Spec โ†’ Trap โ†’ Build โ†’ Audit โ†’ Ship in depth
๐Ÿ“ Topology-Aware Guardrails Domain-specific guardrails for every project type
๐Ÿ”Œ MCP Server & IDE Integration Connecting Gemstack to Cursor, Claude, and Cline
๐Ÿงฉ Building Custom Plugins Extending Gemstack with custom topologies, roles, and hooks
๐Ÿ”ง Full CLI Reference All 28 commands with usage and examples
๐Ÿ› ๏ธ Configuration & Integrations Global config, API keys, and Gemini CLI integration

Project Links

๐Ÿ“‹ Changelog ๐Ÿค Contributing
๐Ÿ”’ Security Policy ๐Ÿ“œ Code of Conduct
๐Ÿ› Report a Bug ๐Ÿ’ก Request a Feature
โš–๏ธ License โ€” Apache 2.0 ๐ŸŽ“ Run gemstack teach for an interactive tutorial

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gemstack-1.0.1.tar.gz (199.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gemstack-1.0.1-py3-none-any.whl (209.7 kB view details)

Uploaded Python 3

File details

Details for the file gemstack-1.0.1.tar.gz.

File metadata

  • Download URL: gemstack-1.0.1.tar.gz
  • Upload date:
  • Size: 199.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for gemstack-1.0.1.tar.gz
Algorithm Hash digest
SHA256 051b8c246c659ab305e32c2d5f3ee050d7f201df9543f143aed9071d1f0b9e3e
MD5 a86ec7ea60171f9e926bd336cb5254ed
BLAKE2b-256 a4b2abc3ec4530953216725e1f2c8ea6a1e1e8f1c6a5f7e3a6a11451517d526b

See more details on using hashes here.

File details

Details for the file gemstack-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: gemstack-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 209.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for gemstack-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ebe1bb4f6128c666305c82e4909f354893b11cc33eafe974abfdae7c8df6ad0d
MD5 28300fce9dcfab55ff028a4c3e6e4183
BLAKE2b-256 adb510456dd14665a40f4f6d9753195916546a77fc12545f67568c8d4b9e9b3a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page