Building Chợ Tốt Knowledge Hub: How AI Agents Accelerated Our Software Development Lifecycle

Building Chợ Tốt Knowledge Hub: How AI Agents Accelerated Our Software Development Lifecycle

Introduction

After more than a decade of rapid engineering growth, Chợ Tốt has evolved into a massive platform spanning dozens of business domains and feature sets. However, scaling both our codebase and our engineering organization introduced natural friction points in how feature knowledge is captured, shared, and utilized.

To overcome these barriers, we built the Chợ Tốt Knowledge Hub - an AI agent designed to answer any question about the Chợ Tốt product ecosystem and integrate directly into our software development workflow.


1. The Problem: Legacy Complexity & The Context Bottleneck

Over 10 years of feature development across multiple independent domain teams resulted in two primary engineering operational bottlenecks:

Challenge 1: Manual "Code Archeology" for Product Context

When Product Managers (PMs) or stakeholders need to scope new requirements, existing documentation is often outdated or incomplete. As a result, PMs have to request engineers to manually dive into production source code to trace historical flows and logic. This context recovery process routinely consumed hours or even days of valuable engineering time.

Challenge 2: Context-Blind AI Coding Agents

While modern AI coding agents can generate code quickly, they lack deep awareness of Chợ Tốt's existing system architecture, service dependency maps, and live configurations. Without this contextual knowledge, coding agents frequently make incorrect assumptions about system states, API flows, and existing service usage.


2. The Solution: Chợ Tốt Knowledge Hub

To bridge the gap between product documentation, source code, and AI capabilities, we developed the Knowledge Hub ecosystem:

  • Repository Intelligence & Spec Extraction: We systematically gathered implementation details across more than 75 core features in our GitHub repositories, parsing code logic into structured feature knowledge bases.
  • Omnichannel Accessibility (Slack & MCP): The Knowledge Hub is accessible directly via a Slack bot for team inquiries and integrated into development tools via the Model Context Protocol (MCP) to serve coding agents.
  • Live Inspection Tools: The underlying agent is equipped with tool-calling capabilities to read live production configurations and current source code in real time.

Architectural Overview: The Lifecycle of Information

The operational framework of the Knowledge Hub is centered on three fundamental pillars: Knowledge Acquisition, Contextual Retrieval, and Continuous Synchronization.

Knowledge Acquisition: Converting Implementation into Structured Intelligence

Leveraging automated agents, we perform deep scans of our source code across the entire technological stack - encompassing backend, web, iOS, and Android platforms. By synthesizing repository logic with associated documentation and issue trackers, our AI pipeline generates dual-layered documentation for every feature.

First, the system produces Technical Specifications tailored for engineering teams, detailing architectural flows, service dependencies, and API schemas. Parallel to this, it generates Product Contexts for cross-functional stakeholders. These documents translate complex logic into business-centric narratives, defining user behavior and validation rules without technical jargon.

The architecture above illustrates how feature knowledge is organized and converted into technical specifications and product context before being mapped to backend services, web applications, and mobile apps.

To ensure absolute factual accuracy, every extracted insight is cross-referenced with production code to eliminate hallucinations. Once validated, these knowledge assets are serialized into a lightweight, high-performance search index (~50 MB) embedded directly within the application. This architectural choice enables near-instantaneous query responses by removing the latency associated with external database lookups.

The architecture above outlines the automated pipeline for knowledge authoring and hybrid indexing, tracing the flow of data from service repositories through the Knowledge Builder to the creation of the final SQLite Hybrid Index.

Contextual Retrieval: Delivering Grounded, Verifiable Insights

Whether a query originates via Slack or through development tools like Claude Code, the Knowledge Hub employs a sophisticated two-stage retrieval process to ensure precision.

Initially, the system identifies relevant feature sets by combining keyword matching - optimized for local Vietnamese terminology - with semantic search. Subsequently, it performs a deep dive within those specific modules to isolate the exact logic, business rule, or architectural snippet required to resolve the inquiry.

To maintain high-fidelity results, the agent is designed to prioritize accuracy over estimation. If the required information is absent from our indices, the system transparently communicates its limitations, provides a directory of available features for refinement, and triggers a silent notification to our engineering team to identify documentation gaps.

Following successful retrieval, the validated data is synthesized by our AI models alongside explicit source citations. This ensures every response remains grounded in traceable, real-world facts, effectively eliminating the risk of technical hallucinations.

The Two-Stage Retrieval Engine diagram outlines the retrieval process: utilizing a two-stage engine for feature and evidence matching (combining FTS5 and vector search), with answer generation handled by the Prompt Builder and Claude Code Runner.

Continuous Synchronization: Documentation That Evolves with the Codebase

In an environment where code is perpetually evolving, documentation must maintain a parallel velocity. To achieve this, we have automated the maintenance cycle: once an engineer completes a modification, they submit a concise ticket outlining the update. This triggers an automated pipeline where an AI agent analyzes the specific code deltas, revises the associated knowledge assets, and executes the same rigorous validation protocols used during initial acquisition. The resulting updates are then submitted as a pull request for human oversight.

Live deployment occurs only after explicit human verification and approval. This ensures that our centralized intelligence remains factually precise and up-to-date, effectively removing the manual documentation burden from the engineering workflow.

The architecture above illustrates the automated continuous synchronization pipeline, where changes in GitHub Issues and source repositories trigger a coordinated update by the AI Knowledge Worker, resulting in validated updates submitted as GitHub pull requests.

Architectural Comparison: Traditional RAG vs. Chợ Tốt Knowledge Hub Design

Dimension

Traditional Vector RAG

Chotot Knowledge Hub Design

Engineering Benefit

Storage Architecture

External Vector DB (Pinecone, Weaviate, Milvus)

Embedded, immutable SQLite Hybrid Database

Zero database infrastructure costs; instant boot; zero network latency for vector/keyword queries.

Vector Density

Chunk-and-embed every 200–500 tokens (10,000+ vectors)

1 vector per feature profile + FTS5 full-text excerpts

Reduces index size by ~90%; maintains holistic feature context; keeps vectors under 50 MB.

Search Strategy

Pure vector cosine similarity

Two-Stage Hybrid Search (BM25 + vectors + title boost + RRF)

Overcomes semantic search blind spots on exact identifiers, endpoint paths, and bilingual terms.

Hallucination Handling

Always attempts to generate an answer

Strict Retrieval Miss Floor

Refuses to guess when evidence is weak; returns indexed feature directory and alerts Slack.

Maintenance

Manual documentation writing

Event-Driven Git-Ops AI Pipeline

Microservice PR merges automatically trigger AI documentation updates with human PR reviews.

3. The Result: Higher Velocity & Measurable Productivity Gains

Since launching Knowledge Hub in March 2026, the system has demonstrated measurable ROI across query performance and delivery speed:

Multi-Disciplinary Use Cases Across Teams

Knowledge Hub caters to stakeholders across the entire product development lifecycle:

  • Stakeholders: Ask high-level operational questions on feature behavior.
  • Product Managers: Retrieve exact business logic, validation rules, and edge cases.
  • Designers: Clarify UI components, entry points, and user screen access flows.
  • Engineers: Inspect underlying architecture, data flows, and service contracts.

1,660 Queries Served Per Month

Between June 11 and July 9, Knowledge Hub resolved 1,660 queries (~60 queries per day). Assuming a modest time savings of 15 minutes per query by avoiding manual code diving, Knowledge Hub saves time equivalent to the monthly capacity of ~2.6 full-time engineers.

1.5x Increase in Delivery Velocity

We tracked engineering throughput in our spec-driven development workflow over two consecutive 10-week periods:

  • Before Knowledge Hub Integration: Average output of 5.2 completed user stories per week.
  • After Knowledge Hub Integration: Average output jumped to 7.7 completed user stories per week.

This represents a 1.5x speedup in weekly delivery output, proving that centralized AI context significantly streamlines story completion.


4. Looking Ahead: The Path to Agentic Engineering

The Knowledge Hub is not just a query tool; it forms the core foundation of our Software Development Life Cycle (SDLC). As new features are built, the knowledge base continuously enriches itself, creating a self-reinforcing engine for project execution.

Our vision for the future is to leverage Knowledge Hub as the backbone of Agentic Engineering at Chợ Tốt. When AI agents share the same deep understanding of our product and systems as our senior engineers, routine execution can run on autopilot. Engineers no longer need to spend time answering repetitive context questions - allowing them to focus on high-impact problem-solving, system architecture, and product innovation.


Loading comments...