Skip to content

AI-Assisted Documentation System

Acumen ERP implements an AI-assisted documentation workflow using the LLMs.txt standard to make documentation discoverable and editable by AI agents.

Overview

Traditional documentation becomes stale quickly. Acumen solves this by:

  1. Detecting code changes via Git hooks
  2. Analyzing changes with Claude API
  3. Generating draft documentation automatically
  4. Human review for accuracy
  5. Auto-deployment to this help site

LLMs.txt Standard

What is LLMs.txt?

The LLMs.txt standard (2025) makes documentation AI-readable:

  • /llms.txt - Index of all documentation pages
  • .md URLs - Every page accessible as raw Markdown
  • Structured metadata - Frontmatter for context
  • Machine-parsable - AI can discover and read all docs

Example LLMs.txt

# Acumen ERP Documentation Map
# https://help.acumen.restrat.co.za/llms.txt

## Developer Documentation
- /developers/index.md - Developer overview
- /developers/getting-started/index.md - Getting started guide
- /developers/api/index.md - API reference
- /developers/architecture/overview.md - Architecture overview

## Consultant Documentation
- /consultants/index.md - Consultant overview
- /consultants/implementation/index.md - Implementation guide

## User Documentation
- /users/index.md - User overview
- /users/features/index.md - Features guide

## AI Integration
- /ai/index.md - AI integration overview
- /ai/llms-txt-standard.md - LLMs.txt documentation
- /ai/claude-integration.md - Claude API integration

How It Works

graph TD
    A[Developer commits code] --> B[Git hook triggers]
    B --> C[Detect file changes]
    C --> D{User-facing changes?}
    D -->|Yes| E[Claude analyzes diff]
    D -->|No| F[Skip documentation]
    E --> G[Load context from llms.txt]
    G --> H[Generate draft Markdown]
    H --> I[Create PR for review]
    I --> J{Human approves?}
    J -->|Yes| K[Merge to docs]
    J -->|No| L[Refine with feedback]
    L --> I
    K --> M[MkDocs builds site]
    M --> N[Deploy to help.acumen.restrat.co.za]

Claude API Integration

1. Change Detection

#!/bin/bash
# .git/hooks/post-commit

CHANGED_FILES=$(git diff --name-only HEAD HEAD~1)

if echo "$CHANGED_FILES" | grep -qE "(backend|frontend)"; then
    echo "🤖 Code changes detected, triggering AI documentation agent..."
    /opt/acumen/help-system/scripts/ai-doc-agent.sh analyze-commit HEAD
fi

2. Context Extraction

# scripts/ai-doc-agent.py

import anthropic
import os

def analyze_code_changes(git_diff):
    client = anthropic.Anthropic(
        api_key=os.environ.get("ANTHROPIC_API_KEY")
    )

    # Load documentation context
    llms_txt = load_llms_txt()
    existing_docs = find_related_docs(git_diff)

    # Build prompt
    prompt = f"""You are documenting Acumen ERP.

Code changes:
{git_diff}

Existing documentation:
{existing_docs}

Generate updated Markdown documentation following the template."""

    message = client.messages.create(
        model="claude-sonnet-4-5-20250929",
        max_tokens=4000,
        messages=[{"role": "user", "content": prompt}]
    )

    return message.content

3. Documentation Template

---
title: {Feature Name}
description: {One-sentence description}
category: developers|consultants|users
tags: [tag1, tag2, tag3]
ai_generated: true
review_status: pending
---

# {Feature Name}

{Introduction explaining what this is and why it matters}

## Overview

{High-level explanation}

## How to Use

{Step-by-step guide}

## API Reference

{If applicable, API endpoints}

## Examples

{Code examples}

## Related Documentation

- [Related Doc 1](link)
- [Related Doc 2](link)

Accessing Machine-Readable Docs

Any page on this site can be accessed as raw Markdown:

Human URL AI URL (Markdown)
/developers/index /developers/index.md
/api/authentication /api/authentication.md
/users/features /users/features.md

Benefits

For Developers

  • Less manual documentation work
  • Docs stay up-to-date with code
  • Consistent formatting across all docs

For Consultants

  • Always-current implementation guides
  • Automatic changelog generation
  • Accurate API references

For AI Agents

  • Discoverable documentation via /llms.txt
  • Structured metadata for context
  • Machine-parsable format

AI Documentation Workflow

Daily Operations

# AI scans for undocumented features
./scripts/ai-doc-agent.sh scan-undocumented

# Manual trigger for specific feature
./scripts/ai-doc-agent.sh --feature="New Module" --mode=interactive

PR-Based Documentation

When you open a pull request:

  1. CI/CD checks if user-facing code changed
  2. AI generates draft documentation
  3. PR includes both code + docs
  4. Review both together
  5. Merge atomically

Configuration

Environment Variables

# Required
ANTHROPIC_API_KEY=sk-ant-xxx

# Optional
AI_DOC_AUTO_MERGE=false  # Require human approval
AI_DOC_MIN_CONFIDENCE=0.8  # Only generate if 80%+ confident

Git Hooks

Enable AI documentation agent:

cd /opt/acumen/help-system
./scripts/setup-git-hooks.sh

Quality Assurance

Human Review Required

AI-generated docs are drafts. Always review for:

  • Technical accuracy
  • Completeness
  • Tone and style
  • Examples work correctly
  • Links are valid

Future Enhancements

  • Screenshot automation with Playwright
  • Video tutorial generation
  • Multi-language translation
  • API doc auto-generation from OpenAPI
  • Interactive code playgrounds

Learn More