documcp: Agent for Claude Code

.github/agents/documcp-ast.md

documcp-ast is an agent for Claude Code from tosin2013/documcp. It costs 20 tokens per session (805 once invoked), scanned A, original, MIT.

A system for examining the structure of source code and finding when documentation no longer matches it. An abstract syntax tree, or AST, is a structured representation of code that allows analysis of functions, classes, types, and relationships.

In plain words
What is it for?
Use it to extract function signatures, classes, inheritance, and complexity from supported programming languages. It also detects outdated, incorrect, missing, and breaking documentation changes.
Why use it?
It can identify documentation that describes old or nonexistent features, misses new ones, or no longer matches breaking code changes. This helps reveal drift that a simple text comparison may miss.

Agent for Claude Code

Written for Claude Code: a Claude Code subagent (agents/*.md).

This is tosin2013/documcp's own configuration. It tells Claude Code how to work on documcp itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything documcp configures →

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { analyzeCodeFile } from "../utils/ast-analyzer.js";.

Reuse

Borrowing it

Nothing to install: this file belongs to tosin2013/documcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/tosin2013/documcp/main/.github/agents/documcp-ast.md
Clone the repo
git clone --depth 1 https://github.com/tosin2013/documcp

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for documcp-ast

README.md
[![agentmods](https://agentmods.dev/badge/agents/tosin2013/documcp/documcp-ast.svg)](https://agentmods.dev/agents/tosin2013/documcp/documcp-ast)
Your own site
<a href="https://agentmods.dev/agents/tosin2013/documcp/documcp-ast"><img src="https://agentmods.dev/badge/agents/tosin2013/documcp/documcp-ast.svg" alt="Measured on agentmods" height="20"></a>
Per session 20 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 805 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00020 $0.00805
Opus 5 $0.00010 $0.00402
Sonnet 5 $0.00004 $0.00161
Haiku 4.5 $0.00002 $0.00081

Measured 8d ago against content hash 882f72c70630, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

documcp-ast scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.github/agents/documcp-ast.md · 126 lines

How it starts

The opening of the file, as written. The whole thing — 126 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are an expert at DocuMCP's AST-based code analysis system (Phase 3).

AST Analysis System

Multi-Language Parser (src/utils/ast-analyzer.ts)

Supports: TypeScript, JavaScript, Python, Go, Rust, Java, Ruby, Bash

Key Features:

  • Function signature extraction with parameters, return types
  • Class analysis with methods, properties, inheritance
  • Interface and type alias extraction
  • Cyclomatic complexity calculation
  • Semantic code comparison (not text diffs)

Usage Pattern

import { analyzeCodeFile } from "../utils/ast-analyzer.js";

const analysis = await analyzeCodeFile("/path/to/file.ts", "typescript");

analysis.functions.forEach((fn) => {
  console.log(`${fn.name}(${fn.parameters.join(", ")}): ${fn.returnType}`);
  console.log(`Complexity: ${fn.complexity}`);
});

Drift Detection System (src/utils/drift-detector.ts)

Automated detection of documentation-code misalignment.

Drift Types

  • Outdated: Documentation references old API signatures
  • Incorrect: Documented features no longer exist
  • Missing: New code features lack documentation
  • Breaking: API changes invalidate existing docs

Severity Levels

  • breaking: Major API changes requiring doc rewrites
  • major: Significant changes needing updates
  • minor: Small changes, low impact
  • patch: Trivial changes

Detection Pattern

import { detectDrift } from "../utils/drift-detector.js";

const drift = await detectDrift({
  projectPath: "/path/to/project",
  docsPath: "/path/to/docs",
  snapshotDir: ".documcp/snapshots",
});

drift.affectedFiles.forEach((file) => {
  console.log(`${file.path}: ${file.driftType} (${file.severity})`);
  file.changes.forEach((change) => {
    console.log(`  - ${change.type}: ${change.description}`);
  });
});

Code-to-Docs Sync Tool

Modes

  • detect: Analyze drift without changes
  • preview: Show proposed changes
  • apply: Apply high-confidence changes (threshold: 0.8)
  • auto: Apply all changes (use caution)

Read the full file on GitHub · 126 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 126 lines · 20 tokens per session scan A 882f72c70630

Subscribe to this mod's changes

documcp-ast is an agent published in the GitHub repository tosin2013/documcp (10 stars, last pushed 1mo ago), licensed MIT. It adds 20 tokens to every session and 805 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other agents, from other repositories

backend-analyzer

Analyze backend services, business logic, and server-side code for inefficient algorithms, blocking operations, or unnecessary computations. Use when user asks about backend performance or runs /n1-optimizer:analyze.

hculap/better-code · 44 tokens

debug-integracao

Especialista em diagnóstico de problemas em integrações com a API da Tray. Utilize quando encontrar erros de autenticação, tokens expirados, limites de requisições excedidos, respostas inesperadas da API ou problemas de validação de dados.

tray-tecnologia/tray-api-ai-plugin · 52 tokens

timps_network_medic

Diagnose network problems: ping internet/Cloudflare, DNS resolution, WiFi signal, traceroute, open ports. Generates a fix script with DNS flush, WiFi reset, and DHCP renewal commands. Use the timpsnetworkmedic MCP tool to perform this task. Do not answer directly — delegate to this sub-agent.

Sandeeprdy1729/timps-swarm · 74 tokens

timps_visual_regression_detective

Diff design tokens / Storybook / screenshot baselines and surface unintended visual changes with root-cause hints. Use the timpsvisualregressiondetective MCP tool to perform this task. Do not answer directly — delegate to this sub-agent.

Sandeeprdy1729/timps-swarm · 58 tokens

scout

Evidence-gathering agent for the /fix pipeline. Given a bug description, greps for error patterns, reads affected source files, and checks recent git changes. Returns a structured evidence report within a ≤6 tool call budget.

huuanh20/awesome-ai-agent-skills · 49 tokens

stata-debugger

Stata error diagnosis and debugging agent. Invoke when a user reports a Stata error, unexpected output, rc code, or do-file that is not working as expected.

tmonk/mcp-stata · 38 tokens