| name | mo-arch |
| description | Query code architecture using README_AI.md index files. Use when user asks about project structure, where features are implemented, how modules work, or wants to understand codebase architecture. Triggered by questions like "what does this do", "where is X implemented", "how does module Y work". |
mo-arch - Code Architecture Query
Query code architecture using README_AI.md index files generated by codeindex.
Workflow
Step 1: Check Project Index
cat PROJECT_INDEX.md 2>/dev/null
If exists, this gives you the project overview with all modules listed.
Step 2: Find Directory Indexes
find . -name "README_AI.md" -type f | head -10
Step 3: Read Relevant Module Index
Based on user's question, locate the relevant module and read its README_AI.md:
cat src/parser/README_AI.md
Step 4: Trace Dependencies
Check the Consumes and Provides sections in README_AI.md to understand module relationships.
Step 5: Deep Dive (if needed)
Only read actual source files when README_AI.md doesn't have enough detail.
Response Format
When answering architecture questions:
- Start with the module location - "The parser is in
src/codeindex/parser.py"
- Explain its purpose - From the Purpose section
- Show relationships - From Consumes/Provides
- Provide code reference - Line numbers if relevant
Example
User: "Where is the parser implemented?"
Response:
Based on README_AI.md, the parser is in `src/codeindex/parser.py`.
**Purpose**: Tree-sitter based Python parser that extracts Symbol
(classes, functions, methods) and Import statements into ParseResult.
**Key exports**:
- `parse_file()` - Parse a single Python file
- `ParseResult` - Container for parsed data
- `Symbol` - Represents a code symbol
**Dependencies**: tree-sitter, tree-sitter-python
When No Index Exists
If README_AI.md files don't exist, suggest:
This directory is not indexed. Run:
codeindex scan ./path/to/dir
Or for the entire project:
codeindex list-dirs | xargs -P 4 -I {} codeindex scan {}
codeindex index