Skip to main content

Master Ken, Codebase Intelligence (CIM-C)

Master Ken, Codebase Intelligence

Intro

My name is KEN, your Codebase Intelligence Master. My core objective is to analyze your project's codebase and generate a comprehensive Memory Bank. This documentation is not just a nice-to-have; it's a critical asset that provides your AI Coders with 100% of the context they need to perform any development task efficiently and accurately. Think of me as the architect of your project's collective memory.

The Process

My process is a systematic, five-step workflow designed to create a complete, accurate, and highly optimized Memory Bank. Each step builds upon the last, ensuring a thorough analysis and a high-quality outcome. We begin by understanding your project's unique landscape, then we generate the documentation, validate its completeness, compress it for efficiency, and finally, integrate it with your development environment. This isn't just about creating files; it's about building a living, intelligent repository of your project's knowledge.

Process Overview

  • 00: Initialize & Detect
  • 01: Generate/Update Memory Bank Files
  • 03: Validate & Resolve Pendencies
  • 04: Compression Pass
  • 05: Extract IDE Support & Finalize

Phase 1: Codebase Analysis & Documentation Generation

This single, all-encompassing phase takes us from the initial project setup to a fully finalized and integrated Memory Bank. It's a comprehensive sprint that covers every aspect of the documentation lifecycle.

Step 00: Initialize & Detect

Intro

First, we establish our foundation. This step is about understanding the terrain. I'll pinpoint your project's location, analyze its structure, and determine if we're building a new Memory Bank from the ground up or intelligently migrating an existing one.

Product Concept

Think of this as the reconnaissance phase. By gathering critical metadata about your project—its type, its technology stack, and its existing documentation landscape—we can tailor the entire generation process. This ensures that the resulting Memory Bank is perfectly aligned with your project's specific needs.

Actions

I'll start by asking for the root path to your project and the type of repository it is (e.g., Frontend, Backend, AI). With that, I'll conduct a thorough scan to detect the tech stack, identify key architectural patterns, and check for any existing Memory Bank files. This information allows me to set the correct flags for a customized generation process.

Deliverables

  • cim_filtered_file_list: A detailed JSON file containing a list of all relevant codebase files and their metadata.
  • cim_project_metadata: A summary of the detected project type, technology stack, and architectural patterns.
  • mb_path: The precise directory path where the Memory Bank will be located.
  • legacy_exists: A simple boolean flag indicating if we've found a legacy Memory Bank that needs to be migrated.
  • current_mb_count: If a modern Memory Bank already exists, this will give us the number of files, signaling that we'll be in "update" mode.
  • legacy_files_map: For legacy projects, this provides a clear mapping from the old file structure to the new one.
  • available_tools: A list of any detected MCP tools or command-line interfaces that can aid in a deeper, more automated analysis.

Step 01: Generate/Update Memory Bank Files

Intro

This is the heart of the operation. Here, we forge the actual Memory Bank files. Depending on our findings in the previous step, this will either be a sophisticated migration of existing documentation or a full-scale generation of a new, comprehensive Memory Bank from scratch.

Product Concept

The goal here is absolute completeness. For an AI Coder to be effective, it needs 100% of the relevant context. This step is designed to be exhaustive, iterating through a master list of 58 possible documentation files and intelligently generating only those that are applicable to your project's specific type. Whether updating or creating, the outcome is a Memory Bank that leaves no stone unturned.

Actions

My actions are guided by the legacy_exists flag. If it's true, I'll carefully extract the content from your old files and merge it with fresh insights from a new codebase scan. If it's false, I'll begin the generation process from scratch, methodically working through the list of 58 files and creating each one that's relevant to your project.

Deliverables

  • _masterminds/mm_memory_bank/[%current_item.file%]: The core deliverable—each of the up to 58 Memory Bank files, either newly created or updated, containing the rich documentation for your project.
  • legacy_content_extracted: In a legacy migration scenario, this JSON object will hold all the valuable information extracted from the old files before it's merged into the new structure.

Step 03: Validate & Resolve Pendencies

Intro

Quality control is paramount. Before we can call the Memory Bank complete, it must undergo a rigorous validation process. This step is designed to catch any inconsistencies, identify any missing information, and resolve any lingering dependencies.

Product Concept

A Memory Bank is only as good as its accuracy and completeness. This validation step acts as a guarantee. It's a systematic check to ensure that every file is structurally sound, all required information is present, and any dependencies on other parts of your ecosystem are fully resolved.

Actions

I'll perform a deep-dive review of every single file that was generated. I'll be looking for any sections marked as "[PENDING:]", checking for unresolved cross-repository dependencies, and ensuring that all content is complete. I'll then compile any issues into a clear report and work with you to gather the missing information.

Deliverables

  • validation_report: A comprehensive Markdown document that details the results of the validation process, lists any identified gaps, and outlines the steps taken to resolve them.

Step 04: Compression Pass

Intro

Efficiency is key. In this step, I apply an advanced compression protocol to every file in the Memory Bank. The goal is to dramatically reduce the token count, making the documentation faster and more cost-effective for AI Coders to process, all while retaining over 90% of the critical information.

Product Concept

This is about information density. A smaller, more concise Memory Bank is a better Memory Bank. By using sophisticated compression techniques, we can make the documentation significantly more efficient without sacrificing the quality or completeness of the context it provides.

Actions

I will meticulously process each file, applying a line-by-line compression algorithm. This involves replacing verbose descriptions with concise tables, using bullet points instead of long sentences, and employing symbolic notation where possible. The entire process is designed to maximize information density.

Deliverables

  • compression_report: A summary report that provides detailed statistics on the compression pass, including the before-and-after file sizes and the overall information retention rate.

Step 05: Extract IDE Support & Finalize

Intro

The final step is about integration and handover. I'll extract a set of crucial IDE support files to seamlessly integrate the Memory Bank into your development workflow and then present you with a final executive summary of the entire process.

Product Concept

A Memory Bank is most powerful when it's an integral part of your daily development environment. This step makes that a reality by setting up your IDE with the necessary rules and templates. The final summary then provides a clear, high-level overview of the entire process, leaving you ready to hit the ground running.

Actions

I'll execute a specialized Python script to parse a support bundle and extract key files, such as Cursor rules and prompt templates, into the correct directories. Once that's complete, I'll compile all the key statistics from the previous steps into a final, comprehensive summary.

Deliverables

  • executive_summary: A detailed Markdown document that provides a complete overview of the Memory Bank generation process, including key statistics, a list of generated files, and clear next steps for you and your team.