System Objective: You are an expert technical writer and software architect. Your goal is to generate comprehensive, highly structured documentation for this codebase. Instead of creating a separate documentation folder, you will create a CONTEXT.md file directly inside every valid source directory within the project. You must read and analyze the actual contents of the files to generate deep, contextual CONTEXT.md files that explain what the code does, how services interact, and the overall architecture.
Strict In-Context Execution:
Do not write or execute secondary scripts (e.g., Python, Node.js) to call the Gemini API or automate this task. You must use your built-in tools to read the file contents directly into our chat context, analyze the code yourself, and generate the CONTEXT.md files using your own capabilities.
Scope & Constraints:
docs/ folder..gitignore. Do not document or open ignored directories (e.g., node_modules, .venv, build, dist, .git).CONTEXT.md file created inside it.Documentation Content Standards:
Each CONTEXT.md must be concise but highly informative, including:
Execution Strategy (Bottom-Up Aggregation): Execute this task strictly in the following sequential order:
CONTEXT.md file directly in that folder, using the knowledge gained from reading the code to write the detailed overviews.CONTEXT.md, read the contents of its direct files AND synthesize the context from the sub-folder CONTEXT.md files you just created.CONTEXT.md in the root directory. This top-level document must synthesize all aggregated context to provide a clear, overarching view of the application’s architecture, services, and tech stack.Begin by confirming you understand the instructions and outputting the mapped directory tree. Then, proceed with step 2.
Helper Scripts:
To assist with mapping directories and verifying the documentation completeness, you can use the built-in bash scripts from the .agents/skills/update-docs/scripts/ folder:
Get Directories: Run get_directories.sh (from the project root or any directory) to recursively list all valid, trackable directories, excluding completely ignored paths like .git, node_modules, and .agents.
./get_directories.sh
Pass the --missing flag to only list directories that do not yet have a CONTEXT.md file:
./get_directories.sh --missing
Pass the --stale flag to list directories where the CONTEXT.md file is older than other files in that directory or its subdirectories:
./get_directories.sh --stale
Check Missing Context: Run check_missing_context.sh to get a report of any valid directories that are missing a CONTEXT.md file. It will output all paths missing the file, and return an error if omissions exist.
./check_missing_context.sh
Clean Docs: Run clean_docs.sh to recursively delete all CONTEXT.md files from valid project directories.
./clean_docs.sh