Skip to content

Commit 7923c8f

Browse files
docs: add AI agent setup guide
1 parent ebbf460 commit 7923c8f

File tree

1 file changed

+158
-0
lines changed

1 file changed

+158
-0
lines changed

docs/ai-agent-setup.md

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
# AI Agent Setup Guide
2+
3+
Instructions for AI coding assistants to install and use agentmap.
4+
5+
## Quick Install (Choose One)
6+
7+
```bash
8+
# Option 1: npx (no install required)
9+
npx agentmap-cli
10+
11+
# Option 2: Homebrew (macOS/Linux)
12+
brew install nguyenphutrong/tap/agentmap
13+
14+
# Option 3: npm global
15+
npm install -g agentmap-cli
16+
17+
# Option 4: Cargo
18+
cargo install agentmap
19+
20+
# Option 5: Direct download
21+
curl -fsSL https://raw.githubusercontent.com/nguyenphutrong/agentmap/main/scripts/install.sh | sh
22+
```
23+
24+
## Generate Documentation
25+
26+
```bash
27+
# Generate docs for current project
28+
agentmap
29+
30+
# Output: .agentmap/ directory with hierarchical docs
31+
```
32+
33+
## Reading Protocol
34+
35+
After generation, navigate the documentation hierarchy:
36+
37+
```
38+
1. Start with .agentmap/INDEX.md
39+
→ Project overview, module list, entry points
40+
41+
2. Go to relevant module: .agentmap/modules/{name}/MODULE.md
42+
→ File list, module structure, child modules
43+
44+
3. Check module docs as needed:
45+
→ outline.md - Symbol maps for large files
46+
→ memory.md - Warnings, TODOs, technical debt
47+
→ imports.md - Dependencies between files
48+
```
49+
50+
## MCP Server (Recommended)
51+
52+
Run agentmap as an MCP server for real-time codebase queries:
53+
54+
```bash
55+
npx agentmap-cli serve --mcp
56+
```
57+
58+
### MCP Config
59+
60+
Add to your AI tool's MCP configuration:
61+
62+
```json
63+
{
64+
"mcpServers": {
65+
"agentmap": {
66+
"command": "npx",
67+
"args": ["agentmap-cli", "serve", "--mcp"]
68+
}
69+
}
70+
}
71+
```
72+
73+
### Available MCP Tools
74+
75+
| Tool | Description |
76+
|------|-------------|
77+
| `regenerate` | Regenerate documentation |
78+
| `get_module` | Get module docs by slug |
79+
| `check_stale` | Check if docs need update |
80+
| `get_outline` | Get symbol outline for a file |
81+
82+
## Project Integration
83+
84+
### Add to AI Instructions
85+
86+
Include in your project's `.cursorrules`, `CLAUDE.md`, or `AGENTS.md`:
87+
88+
```markdown
89+
## Codebase Navigation
90+
91+
Before working on this codebase:
92+
1. Read .agentmap/INDEX.md for project overview
93+
2. Navigate to relevant module's MODULE.md
94+
3. Check memory.md for warnings before editing
95+
4. Use outline.md for large file navigation
96+
```
97+
98+
### Generate Templates
99+
100+
```bash
101+
# Generate AI tool configuration templates
102+
agentmap init --templates
103+
104+
# Generates:
105+
# - .cursorrules (Cursor IDE)
106+
# - CLAUDE.md (Claude Code)
107+
# - AGENTS.md (OpenCode)
108+
```
109+
110+
## Keep Docs Fresh
111+
112+
### Option A: Git Hooks (Automatic)
113+
114+
```bash
115+
agentmap hooks install
116+
```
117+
118+
Docs regenerate on commit, checkout, and merge.
119+
120+
### Option B: Watch Mode (Development)
121+
122+
```bash
123+
agentmap watch
124+
```
125+
126+
Docs regenerate on file save.
127+
128+
### Option C: Manual
129+
130+
```bash
131+
agentmap --check # Check if stale
132+
agentmap # Regenerate
133+
```
134+
135+
## Troubleshooting
136+
137+
### Command not found
138+
139+
```bash
140+
# Verify installation
141+
which agentmap || npx agentmap-cli --version
142+
143+
# Reinstall if needed
144+
npm install -g agentmap-cli
145+
```
146+
147+
### Docs seem stale
148+
149+
```bash
150+
agentmap --force # Force full regeneration
151+
```
152+
153+
### Large repository slow
154+
155+
```bash
156+
agentmap --depth 3 # Limit directory depth
157+
agentmap -i "test/,fixtures/" # Ignore patterns
158+
```

0 commit comments

Comments
 (0)