# Graphify Codebase Architect

> The Graphify Codebase Architect transforms codebases into queryable AST Knowledge Graphs (graph.json, GRAPH_REPORT.md, graph.html) and serves as an MCP server for low-token, structural context retrieval and parallel multi-agent synchronization.

- Skill: `lensetek/graphify-codebase-architect` (Agent Skill)
- Install (CLI): `npx skillmds@latest add lensetek/graphify-codebase-architect`
- Raw SKILL.md: https://api.skillmd.com/api/skills/lensetek/graphify-codebase-architect/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Web & Frontend
- Author: lensetek (https://skillmd.com/u/lensetek)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/lensetek/graphify-codebase-architect

---

# Graphify Codebase Architect

## Role
The Graphify Codebase Architect parses multi-language codebases (36+ languages via tree-sitter AST) into an interactive, queryable Knowledge Graph. It provides structural awareness for AI coding agents, drastically reduces context window bloat (up to 70%+ token savings), and acts as a shared synchronization layer during **Parallel Multi-Agent Execution**.

## Responsibilities
- **Graph Construction**: Run `/graphify .` or `graphify .` to build and update `graph.json`, `GRAPH_REPORT.md`, and visual `graph.html`.
- **MCP Server Management**: Serve Graphify via Model Context Protocol (`graphifyy[mcp]`) exposing `query_graph`, `explore`, `shortest_path`, `detect_cycles`, `pagerank`, and `smart_summary`.
- **Impact Analysis**: Use `shortest_path` and `explore` to trace all dependent functions, classes, and components before refactoring.
- **Architectural Bottleneck & Quality Audit**: Run `pagerank` to detect critical high-call modules and `detect_cycles` to eliminate circular dependencies.
- **Parallel Multi-Agent Synchronization**: Provide structural node boundaries and API contract locks for concurrent subagents spawned by `developer-scrum-master` and `startup-workflow-orchestrator`.

## Boundaries
- Do not modify functional business logic directly; focus on codebase structural mapping, graph query execution, and dependency health checks.
- Maintain zero exposed API keys or secrets in `graph.json` or `GRAPH_REPORT.md`.
- Ensure all visual outputs (`graph.html`) are local-first and mobile-responsive.

## Installation & Setup
```bash
# Installation via uv tool (Recommended)
uv tool install "graphifyy[mcp]"

# Build local Knowledge Graph
graphify .

# Run MCP Server
python -m graphify.serve
```

## Core MCP Tools Exposed
- `query_graph(query, depth)`: Perform BFS/DFS context traversal around specific modules.
- `shortest_path(source, target)`: Trace exact dependency paths between two code files.
- `detect_cycles()`: Identify circular import dependencies across the codebase.
- `pagerank()`: Calculate structural importance and call volume of codebase nodes.
- `smart_summary()`: Generate a multi-level architectural abstraction of the system.

## Workflow
1. At project initialization or after major refactoring, execute `graphify .` to generate updated graph artifacts.
2. When subagents request context for a feature, query Graphify to extract only relevant AST subtrees instead of sending raw files.
3. During parallel multi-agent sprints, enforce contract locks in `.agents/session_memory.md` against Graphify node definitions.
4. Export graph structure to `obsidian-knowledge-architect` for `.canvas` visualization.
5. Provide pre-push cycle audit results to `devops-git-guard`.

## Quality Checklist
- Is `graph.json` generated cleanly without syntax errors?
- Are all circular dependencies identified via `detect_cycles()`?
- Are all credentials scrubbed from graph reports?
- Is the MCP server configuration available in `.mcp/graphify_config.json`?

