Inspiration & Problem Statement
When software teams adopt AI coding assistants (Google Antigravity, Claude Code, Cursor), each agent operates in an isolated, forgetful silo.
In a team of 10 developers:
- Recurring Mistakes & Redundant Token Burn: When Engineer #1's agent spends 45 minutes and 80,000 tokens debugging a distributed database retry quirk or AWS Lambda streaming nuance, Engineer #5's agent repeats that exact painful failure cycle three days later.
- Architectural Drift: Different developer agents invent conflicting conventions, incompatible abstractions, and divergent guardrails.
- The Memory Taxonomy Gap: Current tools focus on Short-term memory (context windows) or Episodic memory (individual chat logs). What teams desperately need is Procedural Memory—how this specific engineering organization writes code, designs systems, and avoids known pitfalls.
What HiveContext Does
HiveContext turns disparate AI agent interactions into a shared, always-on corporate brain:
- Continuous Ingestion via FastMCP: Agents autonomously propose new team coding conventions, architectural decision records (ADRs), post-mortems, and infrastructure specs via native MCP tools.
- Human-in-the-Loop Governance: Proposals enter a Next.js control panel where engineering leads review, modify, or approve them before they enter production context.
- Semantic Cosine RAG in CockroachDB: Approved memories are indexed with 3072-dimensional Gemini embeddings in CockroachDB HNSW vector tables.
- Instant First-Turn Injection: On subsequent tasks, any team member's agent performs a pre-task semantic search (
search_context) to retrieve proven solutions in< 200 tokens, cutting sprint token usage by ~93% and enforcing org-wide consistency.
How I Built It
HiveContext is engineered as a decoupled, multi-tiered architecture combining serverless edge compute with distributed database transactions:
Client Layer (AI Coding Agents):
- Developer agents (Google Antigravity CLI, Claude Code/Desktop, Cursor, and VS Code) connect natively to HiveContext over standard Model Context Protocol (MCP JSON-RPC 2.0 over HTTP/SSE).
- Agents utilize tool definitions for continuous memory ingestion (
remember_convention,log_post_mortem,save_adr,save_infrastructure_context) and pre-task context recall (search_context).
Compute Layer (AWS Lambda FastMCP Server):
- Built with Python 3.12 and FastMCP, running on AWS Lambda using the AWS Lambda Web Adapter (LWA) for high-performance stateless HTTP/SSE streaming.
- Generates 3072-dimensional vector embeddings via Google Gemini (
gemini-embedding-001) on memory ingestion and query transformation. - Orchestrates multi-tenant authentication, authorization tokens, and automated background cleanup crons.
Storage & Vector Indexing Layer (CockroachDB pgvector):
- Serves as the globally distributed, always-on transactional system of record (
hive_contextledger). - Utilizes native
pgvectorwith distributed HNSW cosine distance (<=>) vector indexes, delivering sub-15ms semantic RAG search across millions of context items. - Unifies operational data (approval states, author roles, tenant IDs, scoping rules) and embedding vectors in a single ACID transaction tier—eliminating separate vector databases and synchronization drift.
- Serves as the globally distributed, always-on transactional system of record (
Governance & Control Plane (Next.js 16 on AWS Amplify):
- Provides engineering leaders with a real-time human-in-the-loop review queue to approve, reject, or edit proposed agent memories before they reach production.
- Integrates Google OAuth 2.0 SSO with strict whitelist access control (
ADMIN_EMAILS). - Features automated multi-region tenant space provisioning leveraging the CockroachDB
ccloudCLI and service accounts across AWS regions (ap-south-1,us-east-1,eu-west-1etc..).
Challenges I ran into
Once the prototype was ready with hard-coded dashboard credentials and no bearer token auth for MCP, a team approached with a request to use the prototype among their engineers (21 dev/sdet/architects). The prototype was not at-all production ready at that point.
I had to integrate OAuth layer for dashboard authentication and a dynamic generated bearer token based authentication for MCP server communication.
Ccloud and CockroachDB MCP actually were of great help during the development phases for quick iterations. I probably ran resets and fresh runs atleast 50 times in a day - thanks to the tools.
Accomplishments that I am proud of
The prototype is currently in live usage by 21 engineers of a team working on their production work loads. Over the period of one week, they shared that their CockroachDB billing estimate is pointing to < $50 and AWS lambda(their own enterprise account). They did compute their own metric where they seemed to have saved over 4 Million + tokens. They are using it for centralized ADR, Conventions and RCA/PostMortem reports related to issues they were resolving.
What I learned
I was trying to build something like this using PG and local vector database solutions. The fact that CockroachDB seemlessly distributes and supports multi-region made me so happy. Testing it perform was just fun. The distributed nature was an absolute requirement for distributed teams or region data locked restrictions for teams in EU.
Why CockroachDB is the Crucial Core
- Zero-Downtime System of Record: Agents cannot afford memory downtime or split-brain context. CockroachDB provides multi-region ACID consistency with zero data loss.
- Unified Vector & Operational Data: No separate vector database (like Pinecone/Milvus) needed. Embedding vectors, metadata, access control scopes, approval states, and tenant IDs live transactionally in the exact same table.
- pgvector HNSW Distributed Indexing: Fast cosine distance searches (
<=>) execute in< 15mswith distributed parallel scans across multi-region nodes. - Autonomous Control Plane with
ccloud: The dashboard leverages CockroachDBccloudCLI and service accounts to dynamically provision dedicated, tenant-isolated memory clusters acrossap-south-1,us-east-1, andeu-west-1etc..
How AWS Powers the Infrastructure
- AWS Lambda & AWS Lambda Web Adapter (LWA): Runs FastMCP in a stateless ASGI container with HTTP/SSE streaming, delivering serverless economics with sub-100ms response times.
- AWS Amplify Hosting: Hosts the Next.js 16 SSR Control Panel with global CDN edge caching, Google OAuth session encryption, and automated CI/CD builds.
- AWS SAM (Serverless Application Model): Manages infrastructure-as-code deployments for the Lambda functions, S3 deployment buckets, IAM roles, and daily purge cron triggers.
What's Next for HiveContext
- Automated Semantic Conflict & Contradiction Detection:
- Utilize CockroachDB vector cosine similarity during ingestion to proactively detect and alert reviewers when an agent proposes a convention that contradicts an existing approved architectural decision (e.g. proposing REST when GraphQL is mandated).
- Automated CI/CD Verification & GitHub Actions Integration:
- Run verification agents in GitHub pull requests that automatically query HiveContext to validate whether newly written code complies with approved team conventions and ADRs before merging.
- CockroachDB Changefeeds (CDC) & Multi-Region Event Streaming:
- Stream memory updates via CockroachDB Change Data Capture (CDC) to Amazon EventBridge, enabling instant cache invalidation and notification dispatching to developer Slack channels and IDE sidecars.
- Multi-Model Embedding Adaptability:
- Extend the vector migration engine (
embedding_reembed_job) to dynamically support Bedrock Titan, Cohere Embed, and OpenAI embeddings across tenant spaces with zero downtime.
- Extend the vector migration engine (
- CockroachDB Agent Skills Integration:
- Package HiveContext memory tools as a native skill in the open-source CockroachDB Agent Skills ecosystem for plug-and-play installation in Cursor, Claude Desktop, and Antigravity CLI.
Built With
- amazon-cloudformation
- amazon-web-services
- auth.js-(nextauth)
- aws-amplify
- aws-lambda
- aws-lambda-web-adapter
- aws-sam
- ccloud-cli
- cockroachdb
- cockroachdb-pgvector
- fastmcp
- google-gemini-embeddings-(gemini-embedding-001)
- google-oauth-2.0
- lucide-react
- model-context-protocol-(mcp)
- next.js-16
- psycopg2
- python-3.12
- react-19
- tailwind-css
- typescript
Log in or sign up for Devpost to join the conversation.