Skip to content

Repository files navigation

Klaro Logo

Klaro

From Code to Clarity. Instantly.

License Python Version

Warning

Project halted. Development is on hold for private reasons and there is no active support or feature work right now. The code below reflects the last working state.

Klaro is an autonomous AI agent that reads a codebase and writes its documentation for you: README files, API references, and other Markdown docs generated directly from the source rather than hand-written.

How it works

Klaro runs a pure-Python ReAct (Reasoning and Acting) loop built on LangChain and LangGraph. Given a project directory, it:

  1. Walks the file tree and parses each Python file's AST to extract classes, functions, and structure.
  2. Retrieves relevant context from a ChromaDB vector store seeded with your existing style guides, so the output matches your project's tone and conventions.
  3. Plans and executes tool calls (list_files, analyze_code, web_search) in a loop, self-correcting when a step fails.
  4. Writes the resulting documentation to Markdown.

Quick start

git clone https://github.com/aethrox/klaro.git
cd klaro
python -m venv klaro-env
source klaro-env/bin/activate      # klaro-env\Scripts\activate on Windows
pip install -r requirements.txt
cp .env.example .env               # add OPENAI_API_KEY
python main.py                     # analyzes the current directory

Run it against a different project with python main.py /path/to/project. The ChromaDB knowledge base initializes automatically on first run.

Configuration

Variable Required Default Description
OPENAI_API_KEY Yes - OpenAI API key for LLM calls and embeddings
KLARO_RECURSION_LIMIT No 50 Maximum agent iterations before timeout
LANGSMITH_TRACING No false Enable LangSmith tracing for debugging
LANGSMITH_API_KEY No - LangSmith API key, if tracing is enabled

Klaro defaults to gpt-4o; change the LLM_MODEL variable in main.py for a cheaper or faster model. See the Configuration Guide for the full variable list and model trade-offs, and the Usage Examples Guide for programmatic usage and integration patterns.

Limitations

  • Code analysis currently covers Python only (via the standard library ast module).
  • Requires an OpenAI API key; there is no offline or local-model mode.
  • Multi-format output beyond Markdown, and LangGraph-based model routing to reduce API cost, are planned but not implemented.
  • Development is paused, so open issues and PRs may not be reviewed promptly.

License

MIT, see LICENSE.

About

Autonomous AI agent that reads a codebase and generates its documentation using a LangChain/LangGraph ReAct loop with RAG-based style matching.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages