Skip to content

docs: Comprehensive documentation with Mermaid diagrams and Chutes API integration#2

Merged
echobt merged 1 commit intomainfrom
docs/restructure-with-chutes-integration
Feb 3, 2026
Merged

docs: Comprehensive documentation with Mermaid diagrams and Chutes API integration#2
echobt merged 1 commit intomainfrom
docs/restructure-with-chutes-integration

Conversation

@echobt
Copy link
Contributor

@echobt echobt commented Feb 3, 2026

Summary

This PR restructures the project documentation into a professional, scientific-style format with comprehensive Mermaid diagrams.

Changes

New Documentation Structure

Created docs/ directory with 11 organized Markdown files:

File Description
README.md Documentation index and navigation
overview.md Project overview and design principles
architecture.md Technical architecture with diagrams
installation.md Setup and prerequisites
quickstart.md Getting started guide
configuration.md All configuration options
chutes-integration.md Chutes API documentation
usage.md CLI and command examples
tools.md Complete tools reference
context-management.md Token management strategies
best-practices.md Optimization tips

Mermaid Diagrams

35+ Mermaid diagrams replacing ASCII art:

  • Architecture component diagrams
  • Agent loop flowcharts
  • Sequence diagrams for API flows
  • Context management decision trees
  • State diagrams for verification

Chutes API Integration

Comprehensive documentation for Chutes API as the default LLM provider:

  • Authentication setup (CHUTES_API_TOKEN)
  • Kimi K2.5-TEE model configuration (1T params, 256K context)
  • Thinking mode documentation with <think>...</think> parsing
  • Temperature settings (1.0 for thinking, 0.6 for instant)
  • Fallback to OpenRouter configuration

Usage Examples

Clear command-line examples:

# With Chutes API (default)
export CHUTES_API_TOKEN="your-token"
python3 agent.py --instruction "Your task here..."

# With OpenRouter (fallback)
export LLM_PROVIDER="openrouter"
export OPENROUTER_API_KEY="your-key"
python3 agent.py --instruction "Your task here..."

Updated README

Main README updated to:

  • Reference new documentation structure
  • Include quick start for Chutes API
  • Show architecture overview with Mermaid
  • Link to all documentation sections

References

Acceptance Criteria

  • docs/ folder created with organized documentation structure
  • All diagrams converted to Mermaid format
  • Clear usage instructions with python3 agent.py --instruction examples
  • Chutes API configuration documented (CHUTES_API_TOKEN, LLM_PROVIDER, etc.)
  • Scientific document style with proper sections and technical depth
  • Installation and quickstart guide included
  • Configuration reference with all available options

Summary by CodeRabbit

  • Documentation
    • Restructured main README with simplified Quick Start flow and multi-LLM provider support (Chutes API as default)
    • Added comprehensive documentation suite including architecture overview, installation guide, configuration reference, usage instructions, tools documentation, and best practices
    • Introduced environment variable-based setup replacing manual installation steps

- Create docs/ directory with 11 structured Markdown files
- Add Mermaid diagrams for architecture, agent loop, context management
- Document Chutes API integration (CHUTES_API_TOKEN, Kimi K2.5-TEE)
- Include usage examples with python3 agent.py --instruction
- Cover configuration, tools reference, best practices
- Update README.md to reference new documentation structure
@coderabbitai
Copy link

coderabbitai bot commented Feb 3, 2026

📝 Walkthrough

Walkthrough

This pull request restructures BaseAgent's documentation from a code-centric approach to a documentation-driven onboarding experience. The main README is updated to emphasize multi-provider LLM support (Chutes API by default, with OpenRouter fallback) and streamlined quick-start instructions. A new comprehensive docs/ directory containing 10+ new documentation files is added, covering architecture, configuration, installation, usage, context management, tools, best practices, and provider-specific integration guides.

Changes

Cohort / File(s) Summary
Root Documentation
README.md
Restructured to be documentation-driven with multi-provider LLM support. Replaced code-centric sections with streamlined Quick Start, simplified installation path, and tabular reference for environment variables and key features. Removed detailed inline code/config examples in favor of docs/ directory links.
Documentation - Foundation & Navigation
docs/README.md, docs/overview.md, docs/quickstart.md
Added foundational documentation files: high-level project overview, design principles, quick-start guide with setup steps, expected JSONL outputs, usage examples, and workflow diagrams. Serves as documentation hub and entry point.
Documentation - Architecture & System Design
docs/architecture.md
Comprehensive architecture reference documenting modular system layers (Entry, Core, LLM, Configuration, Tool, Output), component relationships, agent loop orchestration, data flow, context management pipeline, tool execution, JSONL events, and error handling with multiple Mermaid diagrams.
Documentation - Configuration & Installation
docs/installation.md, docs/configuration.md
Installation guide covering prerequisites, multiple setup methods, provider options (Chutes AI, OpenRouter, Direct APIs), verification steps, and troubleshooting. Configuration guide detailing centralized config in src/config/defaults.py, environment variables, provider-specific setup, and computed values with best practices.
Documentation - Context Management
docs/context-management.md
Documents BaseAgent's context window architecture, token estimation heuristics, three-stage management pipeline (Detection, Pruning, AI Compaction), configuration tuning options, monitoring, and best practices for managing context within token limits.
Documentation - Tools & Usage
docs/tools.md, docs/usage.md
Tools reference defining eight tools (shell_command, read_file, write_file, apply_patch, grep_files, list_dir, view_image, update_plan) with parameters, examples, and best practices. Usage guide covers CLI syntax, running agents, environment configuration, JSONL output parsing, logging, session management, and example tasks.
Documentation - Provider Integration
docs/chutes-integration.md
Detailed Chutes AI integration guide covering features, authentication flow, Kimi K2.5-TEE model details, thinking mode processing, OpenAI-compatible API format, fallback strategies, cost tracking, troubleshooting, and best practices for using Chutes as primary LLM provider.
Documentation - Best Practices
docs/best-practices.md
Comprehensive best practices guide detailing core principles (Explore First, Iterate, Verify, Fail Gracefully, Stay Focused) with sections on self-verification, prompt caching, cost optimization, instruction clarity, tool usage patterns, long task handling, error handling, performance tips, and development checklists.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~45 minutes

Poem

Hop, hop—through docs we bound with glee! 🐰
Twelve new guides now set us free,
From architecture to tools so bright,
Chutes, context, all feels right,
BaseAgent's story now complete,
Our documentation feast—so sweet! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately summarizes the main changes: comprehensive documentation restructuring with Mermaid diagrams and Chutes API integration, matching the 11 new documentation files and 35+ diagrams described.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs/restructure-with-chutes-integration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Fix all issues with AI agents
In `@docs/chutes-integration.md`:
- Around line 131-137: Update the docs table entry for the LLM_PROVIDER
environment variable so its default and description reflect "chutes" as the
documented default (replace the current default value "openrouter" and update
the Description cell that currently reads "Set to `chutes`" if inconsistent);
specifically edit the table row for the `LLM_PROVIDER` variable to show Default
= `chutes` and ensure the Description mentions chutes as the default provider to
match the PR objective.

In `@docs/context-management.md`:
- Around line 355-363: The fenced code block showing compaction logs lacks a
language specifier; update the block around the compaction logs (the lines
starting with “[compaction] Context…”) to use a language tag (e.g., ```text) so
Markdown renders it correctly and enables proper syntax highlighting and
compliance.

In `@docs/README.md`:
- Line 5: Update the compound adjective in the BaseAgent description by
replacing "LLM-driven decision making" with "LLM-driven decision-making" so the
phrase correctly hyphenates the modifier; locate the sentence starting
"BaseAgent is a high-performance autonomous agent..." and make this single-word
hyphenation change.

In `@docs/usage.md`:
- Line 68: The markdown example under the header "# Run with inline variables"
is missing a code-fence language tag; update the code block containing the bash
example so the opening fence includes "bash" (i.e., change the opening "```" to
"```bash") so the inline variables example (the line LLM_COST_LIMIT="5.0"
python3 agent.py --instruction "...") is rendered with proper bash highlighting
and consistency.
- Around line 166-167: The markdown code block for the example command lacks a
language specifier; update the usage example around the command "python3
agent.py --instruction \"...\" | jq 'select(.item.type == \"agent_message\") |
.item.content'" to wrap it in a fenced code block with the language identifier
"bash" (i.e., add ```bash before the command and closing ``` after) so the
snippet is markdown-compliant and highlighted.
🧹 Nitpick comments (4)
docs/installation.md (1)

28-35: Replace placeholder organization name with actual repository URL.

The git clone URLs use a placeholder "your-org" which should be replaced with the actual organization name "PlatformNetwork" based on the PR objectives. This makes the commands directly copy-pasteable for users.

📝 Proposed fix for all occurrences
 # Clone the repository
-git clone https://github.com/your-org/baseagent.git
+git clone https://github.com/PlatformNetwork/baseagent.git
 cd baseagent

Apply the same change to lines 43 and 55.

docs/tools.md (1)

94-100: Add language identifiers to fenced code blocks for better rendering.

Several fenced code blocks showing output examples don't have language specifiers. Adding identifiers (e.g., text, bash, or diff) would improve syntax highlighting and rendering across different Markdown viewers.

📋 Suggested language identifiers
  • Line 94: Add text for shell command output
  • Line 131: Add text for file content with line numbers
  • Line 192: Add diff for patch format example
  • Line 263: Add text for grep output
  • Line 306: Add text for directory listing

Example for line 94:

-```
+```text
 total 40
 drwxr-xr-x 7 root root 4096 Feb  3 13:16 .

Also applies to: 131-138, 192-203, 263-267, 306-316

docs/chutes-integration.md (1)

143-155: Add language identifiers to fenced code blocks.

The XML example block (line 143) and bash command (line 314) should have language identifiers for proper syntax highlighting.

📋 Proposed fixes

For line 143:

-```
+```xml
 <think>

For line 314:

-```
+```bash
 export LLM_MODEL="moonshotai/Kimi-K2.5-TEE"

Also applies to: 314-315

docs/best-practices.md (1)

143-145: Add language identifiers to log output code blocks.

The log output examples would benefit from language identifiers for consistent formatting across the documentation.

📋 Proposed fix

For line 143:

-```
+```text
 [14:30:17] [loop] Tokens: 50000 input, 45000 cached, 500 output

For line 314:

-```
+```text
 [compaction] Context overflow detected, managing...

Also applies to: 314-316

Comment on lines +131 to +137
| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| `CHUTES_API_TOKEN` | Yes | - | API token from chutes.ai |
| `LLM_PROVIDER` | No | `openrouter` | Set to `chutes` |
| `LLM_MODEL` | No | `moonshotai/Kimi-K2.5-TEE` | Model identifier |
| `LLM_COST_LIMIT` | No | `10.0` | Max cost in USD |

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Incorrect default value for LLM_PROVIDER environment variable.

The documentation states the default for LLM_PROVIDER is openrouter, but this contradicts the PR objectives which explicitly state "Chutes API is documented as the default LLM provider." This inconsistency could confuse users about which provider is actually configured by default.

📝 Proposed fix
 | Variable | Required | Default | Description |
 |----------|----------|---------|-------------|
 | `CHUTES_API_TOKEN` | Yes | - | API token from chutes.ai |
-| `LLM_PROVIDER` | No | `openrouter` | Set to `chutes` |
+| `LLM_PROVIDER` | No | `chutes` | Provider to use (chutes, openrouter, etc.) |
 | `LLM_MODEL` | No | `moonshotai/Kimi-K2.5-TEE` | Model identifier |
 | `LLM_COST_LIMIT` | No | `10.0` | Max cost in USD |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| `CHUTES_API_TOKEN` | Yes | - | API token from chutes.ai |
| `LLM_PROVIDER` | No | `openrouter` | Set to `chutes` |
| `LLM_MODEL` | No | `moonshotai/Kimi-K2.5-TEE` | Model identifier |
| `LLM_COST_LIMIT` | No | `10.0` | Max cost in USD |
| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| `CHUTES_API_TOKEN` | Yes | - | API token from chutes.ai |
| `LLM_PROVIDER` | No | `chutes` | Provider to use (chutes, openrouter, etc.) |
| `LLM_MODEL` | No | `moonshotai/Kimi-K2.5-TEE` | Model identifier |
| `LLM_COST_LIMIT` | No | `10.0` | Max cost in USD |
🤖 Prompt for AI Agents
In `@docs/chutes-integration.md` around lines 131 - 137, Update the docs table
entry for the LLM_PROVIDER environment variable so its default and description
reflect "chutes" as the documented default (replace the current default value
"openrouter" and update the Description cell that currently reads "Set to
`chutes`" if inconsistent); specifically edit the table row for the
`LLM_PROVIDER` variable to show Default = `chutes` and ensure the Description
mentions chutes as the default provider to match the PR objective.

Comment on lines +355 to +363
```
[14:30:16] [compaction] Context: 45000 tokens (26.8% of 168000)
[14:35:22] [compaction] Context: 125000 tokens (74.4% of 168000)
[14:38:45] [compaction] Context: 148000 tokens (88.1% of 168000)
[14:38:45] [compaction] Context overflow detected, managing...
[14:38:45] [compaction] Prune scan: 95000 total tokens, 55000 prunable
[14:38:45] [compaction] Pruning 12 tool outputs, recovering ~55000 tokens
[14:38:46] [compaction] Pruning sufficient: 148000 -> 93000 tokens
```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add language specifier to fenced code block.

The log output example should specify a language identifier for proper syntax highlighting and markdown compliance.

📝 Proposed fix
-```
+```text
 [14:30:16] [compaction] Context: 45000 tokens (26.8% of 168000)
 [14:35:22] [compaction] Context: 125000 tokens (74.4% of 168000)
 [14:38:45] [compaction] Context: 148000 tokens (88.1% of 168000)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```
[14:30:16] [compaction] Context: 45000 tokens (26.8% of 168000)
[14:35:22] [compaction] Context: 125000 tokens (74.4% of 168000)
[14:38:45] [compaction] Context: 148000 tokens (88.1% of 168000)
[14:38:45] [compaction] Context overflow detected, managing...
[14:38:45] [compaction] Prune scan: 95000 total tokens, 55000 prunable
[14:38:45] [compaction] Pruning 12 tool outputs, recovering ~55000 tokens
[14:38:46] [compaction] Pruning sufficient: 148000 -> 93000 tokens
```
🧰 Tools
🪛 markdownlint-cli2 (0.20.0)

[warning] 355-355: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In `@docs/context-management.md` around lines 355 - 363, The fenced code block
showing compaction logs lacks a language specifier; update the block around the
compaction logs (the lines starting with “[compaction] Context…”) to use a
language tag (e.g., ```text) so Markdown renders it correctly and enables proper
syntax highlighting and compliance.


> **Professional documentation for the BaseAgent autonomous coding assistant**

BaseAgent is a high-performance autonomous agent designed for the [Term Challenge](https://term.challenge). It leverages LLM-driven decision making with advanced context management and cost optimization techniques.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix hyphenation for compound adjective.

The phrase "LLM-driven decision making" should use a hyphen: "LLM-driven decision-making". As per coding guidelines, use a hyphen to join words in compound adjectives.

✏️ Proposed fix
-BaseAgent is a high-performance autonomous agent designed for the [Term Challenge](https://term.challenge). It leverages LLM-driven decision making with advanced context management and cost optimization techniques.
+BaseAgent is a high-performance autonomous agent designed for the [Term Challenge](https://term.challenge). It leverages LLM-driven decision-making with advanced context management and cost optimization techniques.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
BaseAgent is a high-performance autonomous agent designed for the [Term Challenge](https://term.challenge). It leverages LLM-driven decision making with advanced context management and cost optimization techniques.
BaseAgent is a high-performance autonomous agent designed for the [Term Challenge](https://term.challenge). It leverages LLM-driven decision-making with advanced context management and cost optimization techniques.
🧰 Tools
🪛 LanguageTool

[grammar] ~5-~5: Use a hyphen to join words.
Context: ...lenge). It leverages LLM-driven decision making with advanced context management ...

(QB_NEW_EN_HYPHEN)

🤖 Prompt for AI Agents
In `@docs/README.md` at line 5, Update the compound adjective in the BaseAgent
description by replacing "LLM-driven decision making" with "LLM-driven
decision-making" so the phrase correctly hyphenates the modifier; locate the
sentence starting "BaseAgent is a high-performance autonomous agent..." and make
this single-word hyphenation change.

# Cost management
export LLM_COST_LIMIT="10.0"

# Run with inline variables
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add language specifier to inline variable example.

The bash comment should have a language identifier for consistency and proper rendering.

📝 Proposed fix
-# Run with inline variables
+```bash
+# Run with inline variables
 LLM_COST_LIMIT="5.0" python3 agent.py --instruction "..."
🧰 Tools
🪛 markdownlint-cli2 (0.20.0)

[warning] 68-68: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In `@docs/usage.md` at line 68, The markdown example under the header "# Run with
inline variables" is missing a code-fence language tag; update the code block
containing the bash example so the opening fence includes "bash" (i.e., change
the opening "```" to "```bash") so the inline variables example (the line
LLM_COST_LIMIT="5.0" python3 agent.py --instruction "...") is rendered with
proper bash highlighting and consistency.

Comment on lines +166 to +167
# Get all agent messages
python3 agent.py --instruction "..." | jq 'select(.item.type == "agent_message") | .item.content'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add language specifier to jq command example.

The bash comment should have a language identifier for markdown compliance.

📝 Proposed fix
-# Get all agent messages
+```bash
+# Get all agent messages
 python3 agent.py --instruction "..." | jq 'select(.item.type == "agent_message") | .item.content'
🧰 Tools
🪛 markdownlint-cli2 (0.20.0)

[warning] 167-167: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In `@docs/usage.md` around lines 166 - 167, The markdown code block for the
example command lacks a language specifier; update the usage example around the
command "python3 agent.py --instruction \"...\" | jq 'select(.item.type ==
\"agent_message\") | .item.content'" to wrap it in a fenced code block with the
language identifier "bash" (i.e., add ```bash before the command and closing ```
after) so the snippet is markdown-compliant and highlighted.

echobt added a commit that referenced this pull request Feb 3, 2026
This umbrella commit combines changes from all three feature PRs:
- PR #1: Chutes API integration with Kimi K2.5-TEE model
- PR #2: Comprehensive documentation with Mermaid diagrams
- PR #3: Remove OpenRouter support, replace litellm with Chutes API

Conflicts resolved by taking the latest implementation from PR #3,
which provides a cleaner httpx-based client without litellm dependency.
@echobt echobt merged commit c25a4a5 into main Feb 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant