Skip to main content

Master Ken, Codebase Intelligence (CIM-C)

Master Ken, Codebase Intelligence

Intro

I'm KEN, your Codebase Intelligence Master. My purpose is to analyze your project's codebase and generate comprehensive Memory Bank documentation. This ensures your AI Coders have 100% of the context they need for any development session, supporting adaptive generation and intelligent legacy migration.

Process Overview

My workflow is a systematic process to create a complete and accurate Memory Bank tailored to your project. It involves initialization, codebase analysis, conditional legacy migration, documentation generation, validation, and finalization with IDE support.

Phase 1: Codebase Analysis & Documentation Generation

This single, comprehensive phase covers the entire workflow, from initial setup and analysis to the final delivery of a complete, compressed, and validated Memory Bank.

Step 00: Initialize & Detect

Intro

Captures the project path, detects the repository type, and identifies any existing legacy Memory Bank files to set the stage for the entire process.

Product Concept

This step ensures the generation process is perfectly tailored to your specific codebase by setting up foundational parameters, detecting the project's structure, and preparing for either a fresh generation or a legacy migration.

Actions

I will ask for the project's root path and repository type(s). Then, I'll scan the codebase to identify its structure, tech stack, and any existing Memory Bank files, configuring the generation flags accordingly.

Deliverables

  • cim_filtered_file_list: An analyzed list of all relevant files in the codebase with metadata.
  • cim_project_metadata: Detected project type, tech stack, and architectural patterns.
  • mb_path: The detected or user-chosen directory path for the Memory Bank.
  • legacy_exists: A boolean flag that is true if legacy-formatted Memory Bank files are found.
  • current_mb_count: A count of existing files in the current format, indicating an UPDATE operation.
  • legacy_files_map: A JSON object mapping old legacy file names to the new structure.
  • available_tools: A list of detected MCP tools and CLIs that can be used for deeper analysis.

Step 01: Generate/Update Memory Bank Files

Intro

This is the core generation step where all applicable Memory Bank files are created. It operates in one of two modes: legacy migration or generation from scratch.

Product Concept

If legacy files exist, this step intelligently merges historical content with fresh data from a new codebase scan. If not, it generates a complete Memory Bank from scratch, ensuring every file is created with up-to-date information. This step ensures 100% of the applicable documentation is generated to provide complete context for AI Coders.

Actions

Based on the legacy_exists flag, I will either:

  1. Legacy Mode: Read legacy content, scan the codebase for new information, and merge them into the new file structure.
  2. Scratch Mode: Iterate through all 58 possible Memory Bank files, scan the codebase for relevant information for each, and generate only the files applicable to your detected repository type.

Deliverables

  • _masterminds/mm_memory_bank/[%current_item.file%]: Each of the 58 Memory Bank files that are generated or updated during this step.
  • legacy_content_extracted: If in legacy mode, this contains the extracted content mapped to the new structure.

Step 03: Validate & Resolve Pendencies

Intro

A crucial quality assurance step to validate all generated files for completeness, identify any information gaps, and resolve any pending dependencies.

Product Concept

This step guarantees the final Memory Bank is accurate, consistent, and complete. It systematically checks for issues, such as missing sections or cross-repository dependencies, and provides a clear mechanism to resolve these gaps with your input.

Actions

I will perform a comprehensive review of every generated file, checking for completeness, [PENDING:] markers, and unresolved dependencies. I will then compile and present a validation report listing all identified gaps and ask for your input to resolve them.

Deliverables

  • validation_report: A detailed report outlining all identified gaps and the actions taken to resolve them.

Step 04: Compression Pass

Intro

Applies an elite, line-by-line compression protocol to all generated files to significantly reduce token count while ensuring over 90% information retention.

Product Concept

This optimization step makes the Memory Bank highly efficient for AI Coders to process. By making the content as information-dense and concise as possible, it improves the speed and accuracy of the AI Coder.

Actions

I will process each generated file, applying a series of advanced compression techniques (e.g., using tables, bullets, and symbolic notation) to reduce its size while carefully preserving all critical information.

Deliverables

  • compression_report: A report detailing the compression statistics, including before/after file sizes and the overall compression ratio.

Step 05: Extract IDE Support & Finalize

Intro

The final step, which extracts critical IDE support files (like Cursor rules and prompt templates) and presents a final executive summary of the entire generation process.

Product Concept

This step completes the workflow by fully integrating the newly created Memory Bank with the developer's IDE and providing a clear, high-level summary of the outcome, ensuring you are ready to start working with your AI Coder immediately.

Actions

I will execute a Python script to parse a support bundle and extract all IDE support files to their correct locations within your project. I will then compile and present a comprehensive summary of the entire Memory Bank generation process.

Deliverables

  • executive_summary: A complete summary of the Memory Bank generation, including key statistics and next steps.