Context Builder for Openclaw

An agentic CLI tool that converts entire directories into structured, relevance-sorted markdown files optimized for LLM ingestion and token efficiency.

igorls
v0.8.3-1
Feb 16, 2026
0
1.7k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install context-builder

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install context-builder using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Context Builder?

Context Builder is a specialized utility designed to streamline the way AI agents interact with complex codebases. By utilizing this component of Openclaw Skills, developers can generate a single, structured markdown file from any project directory, making it easy for LLMs to understand architecture, find bugs, or perform deep code reviews. The tool intelligently prioritizes files based on relevance—placing configuration and entry points before tests and documentation—ensuring the most critical information is processed first.

Beyond simple file concatenation, Context Builder offers sophisticated features like AST-aware signature extraction and automatic token budgeting. This allows users to provide high-level structural context without exhausting the model's context window. It also features built-in security protections that automatically exclude sensitive directories like node_modules or .git, while respecting your existing .gitignore rules for a seamless and secure developer experience.

Context Builder Use Cases

  • Performing comprehensive architecture reviews and bug hunting sessions with AI agents.
  • Onboarding developers to unfamiliar codebases through structured project snapshots.
  • Generating token-efficient API surface reviews using public signature extraction.
  • Providing incremental updates to LLMs using diff-based context generation.
  • Analyzing monorepo slices by targeting specific sub-packages with scoped filters.

How Context Builder Works

  1. The tool initiates a scan of the specified project directory, applying auto-ignore rules for heavy or sensitive folders.
  2. It respects .gitignore patterns and utilizes UTF-8 sniffing to automatically skip binary files.
  3. Files are sorted using a relevance-based algorithm that prioritizes configuration files and source entry points.
  4. If AST mode is enabled, the tool parses supported languages to extract function and class signatures instead of full source code.
  5. It calculates estimated token counts and applies any specified budgets to ensure the output fits within LLM limits.
  6. A final markdown report is generated, featuring a visual file tree and syntax-highlighted content blocks for optimal AI consumption.

Context Builder Setup

To use this skill, you must have the Rust toolchain installed. Install the CLI tool with the following command to enable full AST support:

cargo install context-builder --features tree-sitter-all

Verify the installation by checking the current version:

context-builder --version

You can also initialize a configuration file in your project root using:

context-builder --init

Context Builder Data Schema & Taxonomy

The output is a single markdown file structured to enhance LLM comprehension:

Section Content Description
Directory Report Contains metadata including project name, active filters, and content hashes.
File Tree A visual map of the included files and directory hierarchy.
Files Syntax-highlighted code blocks or AST signatures, ordered by relevance.

Additionally, an optional context-builder.toml file can be used to manage persistent settings for specific projects in Openclaw Skills workflows.

Context Builder Advanced Features

  • AST Signature Extraction: Drastically reduces token usage by providing only function and class signatures for 8+ programming languages.
  • Token Budgeting: Automatically caps output size and provides warnings if the content exceeds specified token limits (e.g., 100k or 200k).
  • Incremental Diff Mode: Generates only the changes since the last snapshot to minimize token consumption during iterative development.
  • Visibility Control: Filters extracted signatures to show only the public API surface for cleaner architectural reviews.
  • Smart Truncation: Employs AST-aware truncation to keep code structure intact even when files are shortened.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*