← Back to Skills Marketplace
igorls

Context Builder

by igorls · GitHub ↗ · v0.8.3-1
cross-platform ✓ Security Clean
801
Downloads
0
Stars
1
Active Installs
7
Versions
Install in OpenClaw
/install context-builder
Description
Generate LLM-optimized codebase context from any directory using context-builder CLI
README (SKILL.md)

Context Builder — Agentic Skill

Generate a single, structured markdown file from any codebase directory. The output is optimized for LLM consumption with relevance-based file ordering, AST-aware code signatures, automatic token budgeting, and smart defaults.

Installation

# Requires Rust toolchain. Builds from source with cryptographic verification via crates.io.
cargo install context-builder --features tree-sitter-all

Pre-built binaries with SHA256 checksums are also available for manual download from GitHub Releases.

Verify: context-builder --version (expected: 0.8.3)

Security & Path Scoping

IMPORTANT: This tool reads file contents from the specified directory. Agents MUST follow these rules:

  • Only target explicit project directories — always pass the exact project root (e.g., /home/user/projects/myapp). Never point at home directories, system paths, or credential stores (~/.ssh, ~/.aws, /etc, ~, /)
  • Use scoped filters — use -f to limit to known source extensions (e.g., -f rs,toml,md), reducing exposure surface
  • Output to project-local paths — write output to the project's docs/ folder or /tmp/, never to shared or public locations
  • Review before sharing — the output may contain API keys, secrets, or credentials embedded in source files; always review or use .gitignore patterns to exclude sensitive files

Built-in protections (always active, no configuration needed):

  • Excludes .git/, node_modules/, and 19 other heavy/sensitive directories at any depth
  • Respects .gitignore rules when a .git directory is present
  • Binary files are auto-detected and skipped via UTF-8 sniffing
  • Output file and cache directory are auto-excluded to prevent self-ingestion

When to Use

  • Deep code review — Feed an entire codebase to an LLM for architecture analysis or bug hunting
  • Onboarding — Generate a project snapshot for understanding unfamiliar codebases
  • Diff-based updates — After code changes, generate only the diffs to update an LLM's understanding
  • AST signatures — Extract function/class signatures for token-efficient structural understanding
  • Cross-project research — Quickly package a dependency's source for analysis

Core Workflow

1. Quick Context (whole project)

context-builder -d /path/to/project -y -o context.md
  • -y skips confirmation prompts (recommended for agent workflows when path is explicitly scoped)
  • Output includes: header → file tree → files sorted by relevance (config → source → tests → docs)

2. Scoped Context (specific file types)

context-builder -d /path/to/project -f rs,toml -i docs,assets -y -o context.md
  • -f rs,toml includes only Rust and TOML files
  • -i docs,assets excludes directories by name

3. AST Signatures Mode (minimal tokens)

context-builder -d /path/to/project --signatures -f rs,ts,py -y -o signatures.md
  • Replaces full file content with extracted function/class signatures (~4K vs ~15K tokens per file)
  • Supports 8 languages: Rust, JavaScript (.js/.jsx), TypeScript (.ts/.tsx), Python, Go, Java, C, C++
  • Requires --features tree-sitter-all at install time

4. Signatures with Structural Summary

context-builder -d /path/to/project --signatures --structure -y -o context.md
  • --structure appends a count summary (e.g., "6 functions, 2 structs, 1 impl block")
  • Combine with --visibility public to show only public API surface

5. Budget-Constrained Context

context-builder -d /path/to/project --max-tokens 100000 -y -o context.md
  • Caps output to ~100K tokens (estimated)
  • Files are included in relevance order until budget is exhausted
  • Automatically warns if output exceeds 128K tokens

6. Token Count Preview

context-builder -d /path/to/project --token-count
  • Prints estimated token count without generating output
  • Use this first to decide if filtering or --signatures is needed

7. Incremental Diffs

First, ensure context-builder.toml exists with:

timestamped_output = true
auto_diff = true

Then run twice:

# First run: baseline snapshot
context-builder -d /path/to/project -y

# After code changes: generates diff annotations
context-builder -d /path/to/project -y

For minimal output (diffs only, no full file bodies):

context-builder -d /path/to/project -y --diff-only

Smart Defaults

These behaviors require no configuration:

Feature Behavior
Auto-ignore node_modules, dist, build, __pycache__, .venv, vendor, and 12 more heavy dirs are excluded at any depth
Self-exclusion Output file, cache dir, and context-builder.toml are auto-excluded
.gitignore Respected automatically when .git directory exists
Binary detection Binary files are skipped via UTF-8 sniffing
File ordering Config/docs first → source (entry points before helpers) → tests → build/CI → lockfiles

CLI Reference (Agent-Relevant Flags)

Flag Purpose Agent Guidance
-d \x3CPATH> Input directory Always use absolute paths for reliability
-o \x3CFILE> Output path Write to project docs/ or /tmp/
-f \x3CEXT> Filter by extension Comma-separated: -f rs,toml,md
-i \x3CNAME> Ignore dirs/files Comma-separated: -i tests,docs,assets
--max-tokens \x3CN> Token budget cap Use 100000 for most models, 200000 for Gemini
--token-count Dry-run token estimate Run first to check if filtering is needed
-y Skip all prompts Use only with explicit, scoped project paths
--preview Show file tree only Quick exploration without generating output
--diff-only Output only diffs Minimizes tokens for incremental updates
--signatures AST signature extraction Requires tree-sitter-all feature at install
--structure Structural summary Pair with --signatures for compact output
--visibility \x3CV> Filter by visibility all (default), public (public API only)
--truncate \x3CMODE> Truncation strategy smart (AST-aware) or simple
--init Create config file Auto-detects project file types
--clear-cache Reset diff cache Use if diff output seems stale

Recipes

Recipe: Deep Think Code Review

Generate a scoped context file, then prompt an LLM for deep analysis:

# Step 1: Generate focused context
context-builder -d /path/to/project -f rs,toml --max-tokens 120000 -y -o docs/deep_think_context.md

# Step 2: Feed to LLM with a review prompt
# Attach docs/deep_think_context.md and ask for:
# - Architecture review
# - Bug hunting
# - Performance analysis

Recipe: API Surface Review (signatures only)

# Extract only public signatures — typically 80-90% fewer tokens than full source
context-builder -d /path/to/project --signatures --visibility public -f rs -y -o docs/api_surface.md

Recipe: Compare Two Versions

# Generate context for both versions
context-builder -d ./v1 -f py -y -o /tmp/v1_context.md
context-builder -d ./v2 -f py -y -o /tmp/v2_context.md

# Feed both to an LLM for comparative analysis

Recipe: Monorepo Slice

# Focus on a specific package within a monorepo
context-builder -d /path/to/monorepo/packages/core -f ts,tsx -i __tests__,__mocks__ -y -o core_context.md

Recipe: Quick Size Check Before Deciding Strategy

# Check if the project fits in context
context-builder -d /path/to/project --token-count

# If > 128K tokens, try signatures mode first:
context-builder -d /path/to/project --signatures --token-count

# Or scope it down:
context-builder -d /path/to/project -f rs,toml --max-tokens 100000 --token-count

Configuration File (Optional)

Create context-builder.toml in the project root for persistent settings:

output = "docs/context.md"
output_folder = "docs"
filter = ["rs", "toml"]
ignore = ["target", "benches"]
timestamped_output = true
auto_diff = true
max_tokens = 120000
signatures = true
structure = true
visibility = "public"

Initialize one automatically with context-builder --init.

Output Format

The generated markdown follows this structure:

# Directory Structure Report
[metadata: project name, filters, content hash]

## File Tree
[visual tree of included files]

## Files
### File: src/main.rs
[code block with file contents, syntax-highlighted by extension]

### File: src/lib.rs
...

Files appear in relevance order (not alphabetical), prioritizing config and entry points so LLMs build understanding faster.

When --signatures is active, file contents are replaced with extracted signatures:

### File: src/lib.rs
```rust
pub fn run_with_args(args: Args, config: Config, prompter: &dyn Prompter) -> Result\x3C()>
pub fn generate_markdown_with_diff(...) -> Result\x3CString>
```

Error Handling

  • If context-builder is not installed, install with cargo install context-builder --features tree-sitter-all
  • If --signatures shows no output for a file, the language may not be supported or the feature was not enabled at install
  • If output exceeds token limits, add --max-tokens or narrow with -f / -i, or use --signatures
  • If the project has no .git directory, auto-ignores still protect against dependency flooding
  • Use --clear-cache if diff output seems stale or incorrect
Usage Guidance
This skill appears coherent for producing LLM-ready snapshots of projects. Before installing or running it: 1) only point it at explicit project roots (avoid ~, /etc, ~/.ssh, ~/.aws, or other credential stores); 2) prefer running a token-count dry-run or using filters (--token-count, -f) and review outputs before sharing (the tool can surface embedded keys/secrets); 3) verify prebuilt binary checksums from the GitHub Releases page or build from source in a sandboxed environment; 4) be cautious with automated agent runs that use -y (they skip confirmations) — require explicit absolute paths in agent prompts to avoid accidental wide scans.
Capability Analysis
Type: OpenClaw Skill Name: context-builder Version: 0.8.3-1 The skill provides a CLI tool (`context-builder`) to generate LLM-optimized codebase context from local directories. The `SKILL.md` explicitly addresses security concerns, providing clear instructions to the AI agent to avoid targeting sensitive paths (e.g., `~/.ssh`, `/etc`) and to use scoped filters. It also highlights built-in protections like `.gitignore` respect and automatic exclusion of sensitive directories. There is no evidence of malicious intent, data exfiltration, remote execution, persistence mechanisms, or deceptive prompt injection; instead, the instructions are defensive and guide the agent towards secure usage.
Capability Assessment
Purpose & Capability
The skill's name/description (generate LLM-optimized context from a directory) matches the instructions: it calls a context-builder CLI, describes filters, signatures, and token budgeting. The install guidance (cargo install with tree-sitter feature or GitHub releases) is consistent with a CLI that needs language parsers. There are no unrelated env vars, binaries, or config paths requested.
Instruction Scope
The SKILL.md explicitly instructs reading file contents from an input directory (central to the skill). It also documents safeguards (auto-ignore heavy dirs, respects .gitignore, binary detection) and warns that outputs may contain embedded secrets and should be reviewed. This is appropriate for the purpose, but agent workflows that use -y to skip prompts can cause automatic, unreviewed ingestion if the agent is fed an overly broad path — exercise caution and ensure explicit, scoped paths.
Install Mechanism
There is no registry install spec in the skill bundle (instruction-only), but SKILL.md directs installation via cargo (crates.io) or downloading prebuilt binaries from GitHub Releases with SHA256 checksums. Both sources are standard; building requires the Rust toolchain and network access. Recommend verifying checksums and preferring distro packages or pinned release artifacts if available.
Credentials
The skill requests no environment variables or credentials. While the tool will read repository files (which may contain secrets), the declared requirements are minimal and proportionate to the stated functionality.
Persistence & Privilege
The skill does not request 'always: true' and has no install-time persistence specified. It does not ask to modify other skills or system-wide settings. Normal autonomous invocation is allowed by default (disable-model-invocation is false), which is expected for an agentic CLI helper.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install context-builder
  3. After installation, invoke the skill by name or use /context-builder
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v0.8.3-1
- Simplified installation instructions: removed pre-built binary install script details and now direct users to GitHub Releases for manual download. - Clarified recommended source installation and referenced version verification. - No changes to core usage, workflows, CLI reference, or recipes. - Documentation is now more concise and easier to follow for setup and installation.
v0.8.3
- Enhanced installation instructions: now recommends source build by default and adds a secure install script for pre-built binaries with SHA256 checksum verification. - Updated guidance on installation verification and project path safety. - Strengthened security guidance for path scoping and clarified built-in protections. - Minor copy and formatting improvements throughout documentation for clarity and safety.
v0.8.2-1
- Switched default installation instructions to recommend pre-built release binaries over source builds. - Simplified requirements to only list `context-builder` (removed direct mention of `cargo` as required dependency). - Updated installation section with platform-specific download instructions for Linux, macOS (Intel/Apple Silicon), and Windows. - Removed top-level documentation files `CHANGELOG.md` and `README.md`; main skill documentation now lives in `SKILL.md`.
v0.8.2
**Version 0.8.2 Changelog** - Added README.md and CHANGELOG.md files for improved documentation and tracking. - Updated SKILL.md with support for AST-aware code signatures using Tree-Sitter (`--signatures`), new advanced filtering options, and detailed security guidance. - Enhanced CLI reference with new flags: `--signatures`, `--structure`, `--visibility`, and `--truncate`. - Installation instructions now include an option for full Tree-Sitter support. - Expanded recipes and usage examples for incremental diffs, structural summaries, and context minimization.
v0.8.1
No file changes detected. No updates or new features introduced in this version. - Version bumped to 0.8.1, but contents remain unchanged from 0.7.1.
v0.7.2
- Added metadata fields to SKILL.md: homepage, version, and requirements. - Updated the output format section to use plain text instead of markdown code blocks, clarifying syntax highlighting. - No functional or CLI changes; documentation structure and metadata improved for increased clarity and compatibility.
v0.7.1
- Expanded and reorganized SKILL.md with detailed usage instructions, CLI reference, recipes, and configuration guidance. - Clarified core workflows, including quick context, scoped context, token budgeting, diff generation, and error handling. - Documented smart defaults such as auto-ignore rules, ordering strategy, and .gitignore support. - Added concrete agent-focused recipes for deep code review, diffing versions, monorepo slicing, and context size checks. - Outlined output format, file ordering, and practical error resolutions.
Metadata
Slug context-builder
Version 0.8.3-1
License
All-time Installs 1
Active Installs 1
Total Versions 7
Frequently Asked Questions

What is Context Builder?

Generate LLM-optimized codebase context from any directory using context-builder CLI. It is an AI Agent Skill for Claude Code / OpenClaw, with 801 downloads so far.

How do I install Context Builder?

Run "/install context-builder" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Context Builder free?

Yes, Context Builder is completely free (open-source). You can download, install and use it at no cost.

Which platforms does Context Builder support?

Context Builder is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Context Builder?

It is built and maintained by igorls (@igorls); the current version is v0.8.3-1.

💬 Comments