Building a Local Knowledge Base with cm-dockit

Hướng dẫn chi tiết về Building a Local Knowledge Base with cm-dockit trong Vibe Coding dành cho None.

Building a Local Knowledge Base with cm-dockit

The Vibe Coding Hangover: Why Documentation Still Matters

Vibe Coding is a superpower. You sit down with an LLM, describe a vision, and within hours, you have a functioning application. The feedback loop is instantaneous, the progress is intoxicating, and the traditional friction of syntax and boilerplate is gone. However, every superpower comes with a cost. In the world of Vibe Coding, that cost is often “Context Decay.”

We’ve all been there. You spend a weekend building a sophisticated multi-agent system or a complex React dashboard. The “vibe” was perfect. But two weeks later, you return to the codebase to add a feature, and the magic has evaporated. You look at the abstractions the AI created and wonder: Who is this actually for? What was the primary user journey here? Why did we choose this specific state management pattern?

Traditional documentation is too slow for the speed of Vibe Coding. If you stop to manually write a 20-page technical spec, you lose the flow. But if you don’t document, you create a “black box” that even you can’t decode later. This is where cm-dockit comes in. It is designed to be the “Black Box Recorder” for your Vibe Coding sessions—a knowledge systematization engine that turns raw code and transient intent into a permanent, searchable, and AI-readable knowledge base.

Core Concepts: How cm-dockit Systematizes Knowledge

Unlike traditional documentation generators like JSDoc or Doxygen, which focus on function signatures and types, cm-dockit focuses on Intent. It doesn’t just tell you what the code is; it tells you why it exists and how it serves the user. It operates on four primary pillars:

1. Persona Mapping

Every piece of software is a solution for someone. cm-dockit analyzes your components and API endpoints to reverse-engineer the “Personas” interacting with the system. It identifies their goals, pain points, and technical proficiencies. This ensures that when you return to the project, you remember the “who” behind the “what.”

2. Jobs-To-Be-Done (JTBD) Analysis

Software is hired to do a job. cm-dockit looks at the feature set and maps it to specific functional, social, and emotional “Jobs.” It creates a JTBD.md file that outlines the success metrics for each feature. For example, instead of just saying “Login Feature,” it might document: “When I am a returning user, I want to securely access my dashboard with minimal friction, so I can resume my work immediately.”

3. Process Flow Extraction

Vibe Coding often leads to “spaghetti intent”—features that are logically sound but architecturally intertwined. cm-dockit traces the logic across files to generate high-level process flows. It identifies the “Happy Path” and the “Edge Cases,” documenting how data moves from a UI event through the backend and into the database.

4. Knowledge Graph Synthesis

Finally, it organizes all this information into a structured hierarchy. It can output raw Markdown for your GitHub repository or a fully themed, searchable VitePress Premium documentation site. This creates a “Local Knowledge Base” that serves two audiences: the human developer and the AI agent you’ll use in your next session.


Practical Example: Documenting a “Vibe-Coded” Project

Let’s walk through a real-world scenario. Imagine you just finished building a “Self-Learning Content Engine” using Astro and Python. The code is spread across src/pages, scripts/, and content/. You have zero documentation.

Step 1: Initializing the Scan

You trigger cm-dockit to perform a deep scan of the workspace. This isn’t just a file listing; it’s an architectural audit.

# Example command (logical representation)
cm-dockit scan --path ./ --depth 3 --output ./docs

The engine begins by reading your package.json, astro.config.mjs, and your primary entry points. It recognizes the “Vibe” of the project—a content-heavy, automated system.

Step 2: Generating the Intent Layer

Based on the scan, cm-dockit populates the /docs folder with several key artifacts:

  • PERSONAS.md: Identifies a “Content Strategist” (who needs the dashboard) and a “Technical Marketer” (who manages the scripts).
  • JTBD.md: Lists the core jobs, such as “Generate high-quality SEO content from a single keyword.”
  • FLOWS.md: Maps the interaction between the Python script (which fetches data) and the Astro frontend (which renders it).

Step 3: Creating the SOP (Standard Operating Procedure)

One of the most powerful features of cm-dockit is the generation of User Guides and SOPs. It realizes that a Python script requires specific environment variables and a certain execution order. It automatically generates a SETUP_SOP.md that explains exactly how to run the engine you just “vibed” into existence.

Step 4: Exporting to VitePress

To make this knowledge truly accessible, you export it to a local documentation site.

cm-dockit export --format vitepress --theme premium

Now, instead of digging through .mjs files, you have a beautiful, searchable UI that explains your own project back to you.


Why This is Essential for “Multi-Agent” Workflows

In modern Vibe Coding, you aren’t just working with one AI; you are often orchestrating multiple agents. One agent might handle the frontend, while another handles the database schema. The biggest bottleneck in these workflows is Context Transfer.

When you switch tasks or bring in a new agent, you have to spend tokens (and time) explaining the current state of the world. cm-dockit solves this by creating AI-Readable Knowledge. By maintaining a structured docs/ folder with PERSONAS.md and ARCH.md, you can simply point a new agent to your documentation.

The agent reads the documentation, understands the “Intent” and “Architecture,” and can begin contributing immediately without hallucinating about your project’s goals. You are essentially building a “Long-Term Memory” for your codebase.


Best Practices & Tips for Knowledge Systematization

To get the most out of cm-dockit, follow these intermediate-level strategies:

1. The “Commit-Dock” Loop

Don’t wait until the end of the project to document. Run cm-dockit every time you complete a significant logical “track.” If you just implemented a new authentication flow, scan it immediately. This captures the intent while it’s fresh and ensures the documentation evolves alongside the code.

2. Audit the Hallucinations

Since cm-dockit uses LLMs to infer intent, it might occasionally misinterpret a complex abstraction. Treat the generated Markdown as a “draft.” Spend five minutes reviewing the JTBD.md. If the engine thought a feature was for “Data Analysts” but it was actually for “Project Managers,” correct it manually. These manual corrections are high-signal data for your next AI session.

3. Use the “SOP” for Onboarding

Even if you are a solo developer, write your SOPs as if you are hiring a junior dev tomorrow. This forces the AI (via cm-dockit) to define the “Prerequisites” and “Execution Steps” clearly. This is invaluable when you revisit the project six months later on a new machine.

4. Document the “Why,” Not the “How”

The code tells you how it works. Use cm-dockit to focus on the why. If you have a weird workaround for a specific API limitation, make sure it’s reflected in the TECHNICAL_DECISIONS.md. This prevents you or an AI from “optimizing” away a necessary hack in the future.


Advanced Feature: Process Flow Visualization

For intermediate users, the flows capability is a game-changer. cm-dockit can generate Mermaid diagrams directly in your Markdown. When you vibe-code a complex state machine, reading the code is difficult. Seeing a flow chart that shows the transitions from IDLE to PROCESSING to SUCCESS is a cognitive shortcut.

graph TD
    A[User Input] --> B{Validation}
    B -- Valid --> C[Python Worker]
    B -- Invalid --> D[Error UI]
    C --> E[Supabase Storage]
    E --> F[Astro Rebuild]

By having these diagrams auto-generated, you can visually verify if the AI’s logic matches your mental model. If the diagram looks like a bowl of yarn, it’s a sign that your “Vibe” was too broad and you need to refactor for simplicity.


Conclusion: Documentation is the New Context

In the era of Vibe Coding, we need to redefine what “Documentation” means. It is no longer a static PDF that sits on a server; it is Dynamic Context. It is the bridge between your human vision and the AI’s execution.

By using cm-dockit, you transform your ephemeral Vibe Coding sessions into a permanent technical asset. You eliminate the “Vibe Coding Hangover” and ensure that your projects are maintainable, scalable, and ready for collaboration—whether that’s with other humans or more advanced AI agents.

The future of software development isn’t just about writing code faster; it’s about managing knowledge better. Stop losing your “vibe” to the void of forgotten context. Start building your Local Knowledge Base today.

Actionable Next Steps:

  1. Run a Baseline Scan: Take your most complex “vibe-coded” project and run cm-dockit on it.
  2. Review the Personas: See if the AI’s interpretation of your users matches your intent.
  3. Generate an SOP: Create a guide for your most difficult-to-run script.
  4. Point your LLM to the Docs: In your next session, provide the docs/ folder as context and watch the quality of the AI’s contributions improve.