everything-gemini 1.0.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Everything Gemini (everything-gemini) Python SDK Example
4
+ Demonstrates programmatic multi-agent orchestration using the official google-antigravity SDK.
5
+ """
6
+
7
+ import asyncio
8
+ import sys
9
+ from google.antigravity import Agent, LocalAgentConfig, CapabilitiesConfig
10
+
11
+ async def run_pipeline():
12
+ print("🪐 Initializing Everything Gemini Multi-Agent Orchestrator...")
13
+
14
+ # 1. Spawn Planner Subagent
15
+ planner_config = LocalAgentConfig(
16
+ system_instructions=(
17
+ "You are the Strategic Planner agent from everything-gemini. "
18
+ "Analyze the codebase, break the feature into phased milestones, and map architectural risks."
19
+ ),
20
+ capabilities=CapabilitiesConfig(allow_network=False),
21
+ )
22
+
23
+ async with Agent(planner_config) as planner:
24
+ print("\n[Phase 1] šŸ¤– Executing Planner Subagent...")
25
+ planner_response = await planner.chat(
26
+ "Draft an architecture plan to add Redis caching to the API service."
27
+ )
28
+
29
+ plan_output = []
30
+ async for token in planner_response:
31
+ sys.stdout.write(token)
32
+ sys.stdout.flush()
33
+ plan_output.append(token)
34
+
35
+ plan_text = "".join(plan_output)
36
+
37
+ # 2. Handoff Plan to Code Reviewer Subagent
38
+ reviewer_config = LocalAgentConfig(
39
+ system_instructions=(
40
+ "You are the Code Reviewer agent from everything-gemini. "
41
+ "Audit the architectural plan for edge cases, failure modes, and security vulnerabilities."
42
+ ),
43
+ capabilities=CapabilitiesConfig(allow_network=False),
44
+ )
45
+
46
+ async with Agent(reviewer_config) as reviewer:
47
+ print("\n\n[Phase 2] šŸ›”ļø Handing off to Code Reviewer Subagent...")
48
+ review_response = await reviewer.chat(
49
+ f"Review this architectural proposal and list all potential edge cases:\n\n{plan_text}"
50
+ )
51
+
52
+ async for token in review_response:
53
+ sys.stdout.write(token)
54
+ sys.stdout.flush()
55
+
56
+ print("\n\n✨ Multi-agent orchestration completed successfully!")
57
+
58
+ if __name__ == "__main__":
59
+ asyncio.run(run_pipeline())
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "everything-gemini",
3
- "version": "1.0.1",
3
+ "version": "1.2.0",
4
4
  "description": "Everything Gemini (everything-gemini) - The Ultimate Agent Harness, Multi-Agent Orchestrator & Performance Suite for Gemini & Google Antigravity",
5
5
  "main": "bin/everything-gemini",
6
6
  "bin": {
@@ -35,6 +35,7 @@
35
35
  "type": "git",
36
36
  "url": "git+https://github.com/salmandev/everything-gemini.git"
37
37
  },
38
+ "homepage": "https://salmandev.github.io/everything-gemini/",
38
39
  "engines": {
39
40
  "node": ">=18.0.0"
40
41
  }
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: agent-evals
3
+ description: Designs, executes, and benchmarks AI agent evaluation pipelines, LLM-as-a-judge scoring rubrics, golden test datasets, and prompt regression testing harnesses.
4
+ ---
5
+
6
+ # Agent Evals & LLM Benchmark Playbook
7
+
8
+ This skill guides the creation of automated evaluation harnesses, LLM-as-a-judge scoring pipelines, and regression testing suites for AI agents and LLM applications.
9
+
10
+ ---
11
+
12
+ ## 1. Core Principles
13
+
14
+ 1. **Deterministic Assertions First**:
15
+ - Prefer deterministic, unit-testable assertions (schema validation, regex matching, exit codes, latency limits) before falling back to subjective LLM judges.
16
+ 2. **Golden Datasets with Ground Truth**:
17
+ - Maintain versioned golden evaluation datasets (`evals/golden.jsonl`) pairing input prompts with expected outputs or behavioral criteria.
18
+ 3. **Regression Containment**:
19
+ - Any prompt revision or model switch must run against the baseline eval suite to measure accuracy deltas, token consumption, and latency shifts.
20
+
21
+ ---
22
+
23
+ ## 2. Evaluation Dimensions
24
+
25
+ When assessing agent output quality, evaluate across four standardized vectors:
26
+
27
+ | Dimension | Metric | Measurement Method |
28
+ | :--- | :--- | :--- |
29
+ | **Accuracy / Correctness** | Factual precision, task fulfillment | LLM-as-a-judge with binary pass/fail rubric |
30
+ | **Safety & Alignment** | Injection vulnerability, secret leakage | Automated static analysis & safety classifiers |
31
+ | **Schema Compliance** | Valid JSON, Pydantic type conformance | Deterministic parser validation (`json.loads`, Pydantic) |
32
+ | **Context Economics** | Token count, time-to-first-token (TTFT) | Profiler logs & Gemini metadata tokens |
33
+
34
+ ---
35
+
36
+ ## 3. LLM-as-a-Judge Scoring Template
37
+
38
+ When using Gemini as an automated evaluator, structure the prompt with strict zero-shot rubrics and JSON output:
39
+
40
+ ```python
41
+ EVAL_SYSTEM_PROMPT = """You are an impartial, expert evaluation judge.
42
+ Assess the candidate agent response against the provided Reference Criteria.
43
+ Provide a structured JSON evaluation adhering to the schema:
44
+ {
45
+ "score": <float 0.0 to 1.0>,
46
+ "reasoning": "<concise explanation of strengths and shortcomings>",
47
+ "violations": ["<list of any missed constraints>"]
48
+ }
49
+ Only output valid JSON.
50
+ """
51
+ ```
52
+
53
+ ---
54
+
55
+ ## 4. Eval Runner Execution Flow
56
+
57
+ 1. **Load Test Suite**: Ingest test cases from `evals/test_cases.jsonl`.
58
+ 2. **Execute Candidate Prompt**: Query the model with temperature=0.0 for reproducible benchmarking.
59
+ 3. **Run Deterministic Checks**: Validate JSON schema, required keys, and formatting constraints.
60
+ 4. **Run LLM Judge**: Pass model output + reference criteria to the evaluator.
61
+ 5. **Aggregate Metrics**: Calculate overall pass rate, p95 latency, and token cost per run.
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: ai-first-engineering
3
+ description: Decomposes ambiguous software requirements into deterministic milestones, executable acceptance criteria, and test-backed delivery pipelines for AI agent development.
4
+ ---
5
+
6
+ # AI-First Engineering Principles & Delivery Playbook
7
+
8
+ This skill establishes best practices for orchestrating high-velocity software engineering tasks with AI agents. It bridges the gap between human product intent and deterministic, zero-hallucination agent execution.
9
+
10
+ ---
11
+
12
+ ## 1. Core Directives
13
+
14
+ 1. **Deterministic Specification Before Code**:
15
+ - Never write production code based on vague requirements.
16
+ - Deconstruct high-level prompts into verifiable acceptance criteria (Given/When/Then).
17
+ 2. **Blast Radius Minimization**:
18
+ - Scope code modifications strictly to the files necessary to satisfy the feature.
19
+ - Guard against accidental refactoring of unrelated subsystems or styles.
20
+ 3. **Continuous Verification Loop**:
21
+ - Every modification must be coupled with automated validation (unit tests, integration suites, linters, or visual browser assertions).
22
+ - If tests fail, diagnose the root cause from the error log before modifying code.
23
+
24
+ ---
25
+
26
+ ## 2. Requirement Decomposition Matrix
27
+
28
+ When given an ambiguous task (e.g., *"Make user onboarding faster"* or *"Add subscription billing"*), follow this three-stage breakdown:
29
+
30
+ ```
31
+ [Ambiguous Goal] ──► [Milestone Decomposition] ──► [Executable Criteria] ──► [Zero-Regression Delivery]
32
+ ```
33
+
34
+ ### Stage 1: Milestone Decomposition
35
+ Break large tasks into discrete, independently testable phases:
36
+ - **Phase 1: Contracts & Schema**: Types, interfaces, database schemas, and API contracts.
37
+ - **Phase 2: Failing Assertions (Red)**: Unit / integration tests validating expected behavior.
38
+ - **Phase 3: Implementation (Green)**: Minimal surgical code satisfying the tests.
39
+ - **Phase 4: Hardening & Docs (Refactor)**: Error handling, edge cases, logging, and documentation.
40
+
41
+ ### Stage 2: Executable Acceptance Criteria
42
+ Formulate specifications using the standard Gherkin / BDD structure:
43
+ - **Given**: Initial system state and prerequisites.
44
+ - **When**: Specific user or API action occurs.
45
+ - **Then**: Measurable system response, database state, or error envelope.
46
+
47
+ ---
48
+
49
+ ## 3. Risk Radius & Boundary Containment
50
+
51
+ Before modifying core abstractions, evaluate the **Risk Radius**:
52
+
53
+ | Radius Tier | Scope | Required Precautions |
54
+ | :--- | :--- | :--- |
55
+ | **Tier 1: Leaf Node** | Isolated helper functions, standalone components | Standard unit test verification |
56
+ | **Tier 2: Service / Store** | State management, database queries, shared services | Integration tests + typechecking |
57
+ | **Tier 3: Core Abstraction**| DB migrations, auth middleware, global config | Migration rollback plan + full test suite run |
58
+
59
+ ---
60
+
61
+ ## 4. Autonomous Debugging Protocol
62
+
63
+ When encountering unexpected test failures or runtime regressions:
64
+
65
+ 1. **Read Full Error Trace**: Never guess or apply speculative patches without inspecting the actual stack trace.
66
+ 2. **Reproduce in Isolation**: Create a minimal reproduction test or script before touching implementation files.
67
+ 3. **Binary Search (Bisect)**: If behavior unexpectedly changed, identify the breaking commit or input change systematically.
68
+ 4. **Surgical Fix**: Apply the smallest possible fix that resolves the issue while preserving surrounding code formatting and comments.
@@ -0,0 +1,85 @@
1
+ ---
2
+ name: docker-compose-orchestrator
3
+ description: Architects, configures, and troubleshoots multi-container Docker Compose environments, database services (Postgres, pgvector, Redis), healthchecks, and local dev networking.
4
+ ---
5
+
6
+ # Docker Compose Multi-Service Orchestrator
7
+
8
+ This skill guides the design, hardening, and troubleshooting of multi-container local and staging environments using Docker Compose v2.
9
+
10
+ ---
11
+
12
+ ## 1. Core Principles
13
+
14
+ 1. **Deterministic Healthchecks**:
15
+ - Always define explicit `healthcheck` blocks for stateful services (databases, caches, message brokers).
16
+ - Use `depends_on: { condition: service_healthy }` to prevent app containers from starting before databases are ready.
17
+ 2. **Persistent Named Volumes**:
18
+ - Store persistent data (e.g., PostgreSQL data, Redis dumps, uploaded media) in named volumes, never in ephemeral container layers.
19
+ 3. **Environment Isolation**:
20
+ - Use `.env.example` templates with sensible local defaults; never hardcode production secrets in compose files.
21
+
22
+ ---
23
+
24
+ ## 2. Production-Grade Compose Blueprint
25
+
26
+ Example architecture pairing an application server with PostgreSQL (pgvector enabled) and Redis caching:
27
+
28
+ ```yaml
29
+ version: '3.8'
30
+
31
+ services:
32
+ db:
33
+ image: pgvector/pgvector:pg16
34
+ container_name: app_db
35
+ environment:
36
+ POSTGRES_USER: ${POSTGRES_USER:-postgres}
37
+ POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
38
+ POSTGRES_DB: ${POSTGRES_DB:-app_dev}
39
+ ports:
40
+ - "5432:5432"
41
+ volumes:
42
+ - pgdata:/var/lib/postgresql/data
43
+ healthcheck:
44
+ test: ["CMD-SHELL", "pg_isready -U postgres"]
45
+ interval: 5s
46
+ timeout: 5s
47
+ retries: 5
48
+ networks:
49
+ - app-net
50
+
51
+ redis:
52
+ image: redis:7-alpine
53
+ container_name: app_redis
54
+ ports:
55
+ - "6379:6379"
56
+ volumes:
57
+ - redisdata:/data
58
+ healthcheck:
59
+ test: ["CMD", "redis-cli", "ping"]
60
+ interval: 5s
61
+ timeout: 3s
62
+ retries: 5
63
+ networks:
64
+ - app-net
65
+
66
+ volumes:
67
+ pgdata:
68
+ redisdata:
69
+
70
+ networks:
71
+ app-net:
72
+ driver: bridge
73
+ ```
74
+
75
+ ---
76
+
77
+ ## 3. Common Operations & Diagnostics
78
+
79
+ | Command | Action |
80
+ | :--- | :--- |
81
+ | `docker compose up -d` | Start all services in the background |
82
+ | `docker compose ps` | Inspect service health and exposed ports |
83
+ | `docker compose logs -f <service>` | Stream logs for a specific container |
84
+ | `docker compose down -v` | Tear down containers and wipe persistent volumes |
85
+ | `docker compose exec <service> sh` | Open an interactive shell inside a container |
@@ -0,0 +1,90 @@
1
+ ---
2
+ name: gemini-function-calling
3
+ description: >-
4
+ Designs, validates, and tests production Gemini function calling schemas, structured outputs with Pydantic/JSON Schema, parallel tool dispatch, and error recovery loops.
5
+ ---
6
+
7
+ # Gemini Function Calling & Structured Outputs
8
+
9
+ ## Overview
10
+ Gemini models support native, high-precision function calling and constrained JSON output schemas. This skill outlines best practices for defining deterministic tool declarations, handling parallel tool invocations, enforcing response schemas, and recovering gracefully from tool execution exceptions.
11
+
12
+ ## Core Capabilities
13
+
14
+ ### 1. Function Declarations (Tools)
15
+ Define tools with clear semantics, parameter types, descriptions, and required constraints:
16
+
17
+ ```python
18
+ from google.genai import types
19
+
20
+ def get_db_schema_declaration() -> types.FunctionDeclaration:
21
+ return types.FunctionDeclaration(
22
+ name="query_database",
23
+ description="Executes a read-only SQL query against the application replica.",
24
+ parameters=types.Schema(
25
+ type=types.Type.OBJECT,
26
+ properties={
27
+ "query": types.Schema(
28
+ type=types.Type.STRING,
29
+ description="The SQL query to execute. Must be a SELECT statement."
30
+ ),
31
+ "limit": types.Schema(
32
+ type=types.Type.INTEGER,
33
+ description="Maximum number of rows to return (default: 50, max: 200)."
34
+ )
35
+ },
36
+ required=["query"]
37
+ )
38
+ )
39
+ ```
40
+
41
+ ### 2. Structured JSON Outputs (`response_schema`)
42
+ When an application requires guaranteed JSON outputs matching a domain model, configure `response_mime_type="application/json"` and supply a `response_schema` (or Pydantic class):
43
+
44
+ ```python
45
+ from pydantic import BaseModel, Field
46
+
47
+ class CodeAnalysisReport(BaseModel):
48
+ summary: str = Field(description="High-level architecture assessment")
49
+ vulnerabilities: list[str] = Field(description="List of identified security vulnerabilities")
50
+ risk_score: int = Field(description="Risk rating from 1 (lowest) to 10 (critical)", ge=1, le=10)
51
+
52
+ config = types.GenerateContentConfig(
53
+ response_mime_type="application/json",
54
+ response_schema=CodeAnalysisReport,
55
+ temperature=0.1
56
+ )
57
+ ```
58
+
59
+ ### 3. Parallel & Multi-Turn Function Calling
60
+ - **Parallel Dispatch**: Gemini can return multiple function calls in a single response turn. Process independent read operations concurrently using `asyncio.gather` or `Promise.all`.
61
+ - **Function Response Envelope**: Return the results of each tool back to the model with matching tool names and execution status:
62
+
63
+ ```python
64
+ tool_response_part = types.Part.from_function_response(
65
+ name="query_database",
66
+ response={"status": "success", "rows": rows, "count": len(rows)}
67
+ )
68
+ ```
69
+
70
+ ### 4. Error Recovery & Defensive Handling
71
+ When a tool execution fails (e.g., database timeout or syntax error):
72
+ 1. **Never suppress the error silently**: Feed the error back to Gemini in the function response envelope.
73
+ 2. **Include Contextual Remediation**: Inform the model why the call failed so it can self-correct in the next turn:
74
+
75
+ ```python
76
+ error_part = types.Part.from_function_response(
77
+ name="query_database",
78
+ response={
79
+ "status": "error",
80
+ "error_code": "SYNTAX_ERROR",
81
+ "message": "Column 'user_id' does not exist in table 'accounts'. Available columns: [id, account_number, balance]."
82
+ }
83
+ )
84
+ ```
85
+
86
+ ## Verification Checklist
87
+ - [ ] Tool parameters have unambiguous `description` fields
88
+ - [ ] `required` fields explicitly defined
89
+ - [ ] Read-only vs destructive operations strictly separated
90
+ - [ ] Tool execution errors safely fed back to model for autonomous self-correction
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: github-ops
3
+ description: Orchestrates GitHub workflows, automated Pull Request generation, code review triage, release management, and issue automation using GitHub MCP and the gh CLI.
4
+ ---
5
+
6
+ # GitHub Ops & Repository Lifecycle Automation
7
+
8
+ This skill guides the agent in managing end-to-end GitHub workflows, creating production-grade Pull Requests, performing automated multi-file code reviews, orchestrating releases, and triaging issues.
9
+
10
+ ---
11
+
12
+ ## 1. Operating Principles
13
+
14
+ 1. **Atomic & Linear Commits**:
15
+ - Keep Pull Requests focused on a single logical change or feature.
16
+ - Use Conventional Commits (`feat:`, `fix:`, `refactor:`, `docs:`, `chore:`).
17
+ 2. **Deterministic Verification Before PR**:
18
+ - Always run the local test suite and lint verification before creating or updating a PR.
19
+ - Never push failing code or uncommitted working trees.
20
+ 3. **Traceability**:
21
+ - Every PR must link back to an issue or feature specification (`Closes #123` or `Refs #456`).
22
+ - Every release tag must be accompanied by an auto-generated or structured changelog.
23
+
24
+ ---
25
+
26
+ ## 2. GitHub CLI (`gh`) & MCP Integration
27
+
28
+ When interacting with GitHub, use either the configured **GitHub MCP Server** or the standard **`gh` CLI**.
29
+
30
+ ### Essential `gh` Command Patterns
31
+
32
+ | Task | Command |
33
+ | :--- | :--- |
34
+ | **Check Auth Status** | `gh auth status` |
35
+ | **Inspect Open Issues** | `gh issue list --limit 10` |
36
+ | **View Issue Details** | `gh issue view <issue-number>` |
37
+ | **Create Pull Request** | `gh pr create --title "..." --body "..."` |
38
+ | **View PR Status & Checks** | `gh pr status` / `gh pr checks` |
39
+ | **View PR Diff** | `gh pr diff <pr-number>` |
40
+ | **Add PR Comment/Review** | `gh pr review <pr-number> --comment -b "..."` |
41
+ | **Merge Pull Request** | `gh pr merge <pr-number> --squash --delete-branch` |
42
+ | **Create Release Tag** | `gh release create v1.1.0 --title "v1.1.0" --notes "..."` |
43
+
44
+ ---
45
+
46
+ ## 3. Pull Request Generation Workflow
47
+
48
+ When authoring a Pull Request on behalf of the user, follow this structured template:
49
+
50
+ ```markdown
51
+ ## šŸŽÆ Overview
52
+ <!-- 1-2 concise sentences summarizing the problem solved or capability introduced -->
53
+
54
+ ## šŸ› ļø Changes Implemented
55
+ - **Component / File**: High-level explanation of modification.
56
+ - **Architectural Decision**: Rationale for design choices or trade-offs.
57
+
58
+ ## 🧪 Verification & Testing
59
+ - [x] Unit / Integration tests pass (`npm test`, `pytest`, or `cargo test`).
60
+ - [x] Linters and typecheckers pass (`npm run lint`, `tsc --noEmit`).
61
+ - [x] Verified zero breaking changes to existing public APIs.
62
+
63
+ ## šŸ”— Related Issues
64
+ Closes #<issue-number>
65
+ ```
66
+
67
+ ---
68
+
69
+ ## 4. Automated PR Review Protocol
70
+
71
+ When performing automated reviews on a GitHub PR:
72
+
73
+ 1. **Fetch & Inspect Diff**:
74
+ ```bash
75
+ gh pr diff <pr-number>
76
+ ```
77
+ 2. **Review Checklist**:
78
+ - **Correctness**: Does the code satisfy the acceptance criteria without subtle edge-case failures?
79
+ - **Security**: Are there unsanitized inputs, hardcoded secrets, or privilege escalations?
80
+ - **Performance**: Are there N+1 database queries, unmemoized expensive loops, or memory leaks?
81
+ - **Style & Standards**: Does it adhere to the repository's established conventions?
82
+ 3. **Submitting Feedback**:
83
+ - Use `gh pr review <pr-number> --comment` for non-blocking suggestions.
84
+ - Use `gh pr review <pr-number> --request-changes` for critical bugs or regressions.
85
+ - Use `gh pr review <pr-number> --approve` once all checks pass.
86
+
87
+ ---
88
+
89
+ ## 5. Release Automation
90
+
91
+ To publish a clean semantic release:
92
+ 1. Verify `package.json` / version files are updated.
93
+ 2. Ensure working tree is clean (`git status`).
94
+ 3. Create and push git tag:
95
+ ```bash
96
+ git tag vX.Y.Z
97
+ git push origin vX.Y.Z
98
+ ```
99
+ 4. Generate release notes with GitHub CLI:
100
+ ```bash
101
+ gh release create vX.Y.Z --generate-notes
102
+ ```
@@ -0,0 +1,78 @@
1
+ ---
2
+ name: graphql-architect
3
+ description: Designs, specifies, and implements production GraphQL APIs, DataLoader N+1 query batching, Relay-style cursor pagination, and schema federation.
4
+ ---
5
+
6
+ # GraphQL Architecture & API Craftsmanship
7
+
8
+ This skill guides the design, schema modeling, query optimization, and implementation of production-grade GraphQL APIs.
9
+
10
+ ---
11
+
12
+ ## 1. Core Principles
13
+
14
+ 1. **Schema-First Design**:
15
+ - Model client domain requirements into a declarative Schema Definition Language (SDL) before implementing resolvers.
16
+ 2. **Defeat the N+1 Problem**:
17
+ - Never query database tables inside nested resolvers without a batching mechanism (e.g., `DataLoader`).
18
+ 3. **Cursor-Based Pagination**:
19
+ - For real-time or dynamic lists, implement Relay-compliant cursor pagination (`Connection`, `Edge`, `PageInfo`) rather than offset/limit pagination.
20
+
21
+ ---
22
+
23
+ ## 2. Relay-Compliant Cursor Pagination Pattern
24
+
25
+ ```graphql
26
+ type PageInfo {
27
+ hasNextPage: Boolean!
28
+ hasPreviousPage: Boolean!
29
+ startCursor: String
30
+ endCursor: String
31
+ }
32
+
33
+ type UserEdge {
34
+ cursor: String!
35
+ node: User!
36
+ }
37
+
38
+ type UserConnection {
39
+ edges: [UserEdge!]!
40
+ pageInfo: PageInfo!
41
+ totalCount: Int!
42
+ }
43
+
44
+ type Query {
45
+ users(first: Int, after: String): UserConnection!
46
+ }
47
+ ```
48
+
49
+ ---
50
+
51
+ ## 3. DataLoader Batching Blueprint
52
+
53
+ Prevent database query fan-out by batching IDs into a single SQL `IN` query per event loop tick:
54
+
55
+ ```typescript
56
+ import DataLoader from 'dataloader';
57
+
58
+ // Batch function loading users by array of IDs
59
+ const batchUsers = async (userIds: readonly string[]): Promise<(User | Error)[]> => {
60
+ const users = await db.user.findMany({
61
+ where: { id: { in: [...userIds] } },
62
+ });
63
+
64
+ // Map results back to exact input order
65
+ const userMap = new Map(users.map(u => [u.id, u]));
66
+ return userIds.map(id => userMap.get(id) || new Error(`User ${id} not found`));
67
+ };
68
+
69
+ export const createUserDataLoader = () => new DataLoader(batchUsers);
70
+ ```
71
+
72
+ ---
73
+
74
+ ## 4. Query Complexity & Depth Limiting
75
+
76
+ To prevent Denial-of-Service attacks through cyclic or deeply nested queries:
77
+ - Enforce maximum query depth (e.g., max 6 levels).
78
+ - Assign cost multipliers to nested connections to reject queries exceeding complexity thresholds.
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: rag-architect
3
+ description: >-
4
+ Designs retrieval-augmented generation (RAG) pipelines, semantic chunking strategies, hybrid keyword-vector search, re-ranking, and pgvector embeddings using Gemini models.
5
+ ---
6
+
7
+ # RAG Architecture & Vector Retrieval with Gemini
8
+
9
+ ## Overview
10
+ Retrieval-Augmented Generation (RAG) equips Gemini with localized repository context, enterprise documentation, and proprietary knowledge bases. This skill outlines production architectures for dense embeddings, semantic chunking, hybrid search (keyword + vector), and Gemini-powered re-ranking.
11
+
12
+ ## Core RAG Pipeline
13
+
14
+ ```
15
+ [Documents] ──► [Semantic Chunker] ──► [text-embedding-004] ──► [Vector DB / pgvector]
16
+ │
17
+ [User Query] ──► [Hybrid Retrieval: BM25 + Dense Vector] ───────────────┤
18
+ ā–¼
19
+ [Gemini Reranker & Filter]
20
+ ā–¼
21
+ [Context Window (Cached)]
22
+ ā–¼
23
+ [Grounded Synthesis]
24
+ ```
25
+
26
+ ## Architectural Guidelines
27
+
28
+ ### 1. Embedding Model Selection
29
+ - Use **`text-embedding-004`** (768 dimensions) for semantic vector representations.
30
+ - Apply task types appropriately when generating embeddings:
31
+ - `RETRIEVAL_DOCUMENT`: For indexing documents into the knowledge store.
32
+ - `RETRIEVAL_QUERY`: For embedding the user's incoming query.
33
+ - `SEMANTIC_SIMILARITY`: For clustering and duplicate detection.
34
+
35
+ ### 2. Semantic Chunking Strategies
36
+ - **Code Repositories**: Chunk by syntax boundaries (AST classes, functions, modules) rather than fixed token lengths.
37
+ - **Documentation**: Chunk by markdown headers (`##`, `###`) preserving title hierarchy as chunk metadata.
38
+ - **Overlap**: Maintain a 10-15% token overlap across sliding windows to prevent boundary truncation of critical concepts.
39
+
40
+ ### 3. Hybrid Retrieval (Sparse + Dense)
41
+ Never rely exclusively on vector distance. Combine:
42
+ - **Dense Vector Search**: Cosine or inner product similarity via `pgvector` or Qdrant for semantic meaning.
43
+ - **Sparse Keyword Search**: Full-text search (BM25 or PostgreSQL `tsvector`) for exact identifier matches, error codes, and function names.
44
+ - Combine scores using Reciprocal Rank Fusion (RRF):
45
+ $$RRF(d) = \sum \frac{1}{60 + r_i(d)}$$
46
+
47
+ ### 4. Gemini Two-Stage Reranking
48
+ 1. Retrieve top 50 candidates from hybrid search.
49
+ 2. Pass the top 50 candidate snippets to `gemini-1.5-flash` or `gemini-3.8` for high-speed relevance scoring and deduplication.
50
+ 3. Inject the top 5-10 highest-scoring excerpts into the reasoning context window.
51
+
52
+ ### 5. Context Injection & Static Prefix Caching
53
+ - Structure prompt templates with static instruction prefixes placed before retrieved dynamic context to maximize Gemini's automatic **Prefix Context Caching**.
54
+ - Tag all retrieved chunks with clickable source links: `[source.py:L10-L45](file:///path/to/source.py#L10-L45)`.
55
+
56
+ ## Verification Checklist
57
+ - [ ] Appropriate embedding task types specified (`RETRIEVAL_DOCUMENT` vs `RETRIEVAL_QUERY`)
58
+ - [ ] Chunks respect syntax and AST boundaries
59
+ - [ ] Hybrid search active for exact symbol matching
60
+ - [ ] Clickable `file://` citations attached to synthesized outputs
@@ -0,0 +1,12 @@
1
+ # Antigravity Enterprise Standards (Full-Power Profile)
2
+
3
+ ## 1. Prime Directives
4
+ 1. **Zero Hallucination & Evidence-First**: Never speculate on APIs, schemas, or dependencies. Always view code before proposing edits.
5
+ 2. **Subagent Delegation Discipline**: Defer heavy multi-file exploration to `planner`, adversarial audits to `security-auditor`, and UI verification to `browser-qa`.
6
+ 3. **Progressive Disclosure**: Keep prompt context lean (<3,500 tokens). Pull skills and schemas into context strictly on-demand.
7
+ 4. **Deterministic Verification Loop**: Code changes require passing automated tests (`npm test` / pytest) before concluding.
8
+ 5. **Continuous Learning**: When errors or user corrections occur, record the insight using `/learn` into permanent Knowledge Items.
9
+
10
+ ## 2. Security & Operational Policy
11
+ - Strict zero-trust command execution: All raw shell commands must pass GeminiShield gating.
12
+ - Webhooks, tokens, and credentials must be read from environment variables with no hardcoding.
@@ -0,0 +1,12 @@
1
+ # Antigravity Enterprise Standards (Full-Power Profile)
2
+
3
+ ## 1. Prime Directives
4
+ 1. **Zero Hallucination & Evidence-First**: Never speculate on APIs, schemas, or dependencies. Always view code before proposing edits.
5
+ 2. **Subagent Delegation Discipline**: Defer heavy multi-file exploration to `planner`, adversarial audits to `security-auditor`, and UI verification to `browser-qa`.
6
+ 3. **Progressive Disclosure**: Keep prompt context lean (<3,500 tokens). Pull skills and schemas into context strictly on-demand.
7
+ 4. **Deterministic Verification Loop**: Code changes require passing automated tests (`npm test` / pytest) before concluding.
8
+ 5. **Continuous Learning**: When errors or user corrections occur, record the insight using `/learn` into permanent Knowledge Items.
9
+
10
+ ## 2. Security & Operational Policy
11
+ - Strict zero-trust command execution: All raw shell commands must pass GeminiShield gating.
12
+ - Webhooks, tokens, and credentials must be read from environment variables with no hardcoding.