本文へ移動
cccskills
無料GitHub で公開

context-builder

Package codebases into LLM-optimized markdown, and run the Deep Think Authority pipeline (context-builder → Deep Think review → structured AUTHORITY → Flash/Antigravity implementation agent). Use when generating project context, preparing Deep Think reviews, or binding a weaker coding agent to a senior reasoning pass.

インストール方法を見る

含まれるファイル(116)

  • SKILL.md14.7 KB
  • .agent/rules/code-style-guide.md47 B
  • .agent/workflows/terminal-hang-workaround.md2.0 KB
  • .github/dependabot.yml702 B
  • .github/workflows/ci.yml2.7 KB
  • .github/workflows/release.yml4.4 KB
  • .gitignore1.0 KB
  • AGENTS.md9.1 KB
  • benches/context_bench.rs11.3 KB
  • BENCHMARKS.md5.9 KB
  • Cargo.lock38.6 KB
  • Cargo.toml4.5 KB
  • CHANGELOG.md33.3 KB
  • context-builder.toml1.3 KB
  • DEVELOPMENT.md7.5 KB
  • docs/agent-harness/antigravity-system-prompt.md4.3 KB
  • docs/agent-harness/README.md5.9 KB
  • docs/agent-harness/templates/01-problem.md1.4 KB
  • docs/agent-harness/templates/02-authority.md990 B
  • docs/agent-harness/templates/03-build.md1.1 KB
  • docs/agent-harness/templates/04-result.md483 B
  • docs/agent-harness/templates/05-conflict.md832 B
  • docs/demo.gif429.1 KB
  • docs/demo.mp4369.0 KB
  • docs/research/Babysitter v0.0.166.md9.5 KB
  • docs/research/competitive-analysis.md13.0 KB
  • docs/research/multi-model-code-review-analysis-v3.md14.6 KB
  • docs/research/multi-model-code-review-analysis.md19.5 KB
  • docs/research/next-release-roadmap.md18.5 KB
  • docs/research/prompts/clean_benchmark_v6.md1.2 KB
  • docs/research/prompts/deep_think_prompt_v3_multimodel.md7.7 KB
  • docs/research/prompts/deepthink_prompt_v2.md5.1 KB
  • docs/research/prompts/deepthink_prompt_v5.md5.8 KB
  • docs/research/v0.10-plan.md5.0 KB
  • docs/research/v2-responses/context_v2_resp-chat-gpt-5.2.md9.4 KB
  • docs/research/v2-responses/context_v2_resp-claude-opus-4.6.md24.3 KB
  • docs/research/v2-responses/context_v2_resp-gemini-3-deepthink.md10.3 KB
  • docs/research/v2-responses/context_v2_resp-gemini-pro.md9.0 KB
  • docs/research/v2-responses/context_v2_resp-glm5-run2.md11.0 KB
  • docs/research/v2-responses/context_v2_resp-glm5.md10.6 KB
  • docs/research/v2-responses/context_v2_resp-grok.md9.8 KB
  • docs/research/v2-responses/context_v2_resp-kimi-k2.5.md23.0 KB
  • docs/research/v2-responses/context_v2_resp-minimax-agent.md33.7 KB
  • docs/research/v2-responses/context_v2_resp-qwen3-max.md14.9 KB
  • docs/research/v2-responses/deepthink_response_v1.md11.8 KB
  • docs/research/v3-responses/context_v3_resp-gemini-3-deepthink.md9.7 KB
  • docs/research/v3-responses/context_v4_resp-gemini-3-deepthink.md8.9 KB
  • docs/research/v3-responses/context_v5_resp-gemini.md9.2 KB
  • docs/research/v3-responses/context_v6_resp-gemini.md9.0 KB
  • docs/research/v3-responses/deep_think_v3_resp-claude-chatgpt-5.3-codex-xhigh.mc4.9 KB
  • docs/research/v3-responses/deep_think_v3_resp-claude-opus-4.6.mc13.4 KB
  • docs/research/v3-responses/deep_think_v3_resp-gemini-3-deepthink.md10.0 KB
  • docs/research/v3-responses/deep_think_v3_resp-grok.md8.9 KB
  • docs/research/v3-responses/deep_think_v3_resp-kimi.md9.6 KB
  • docs/research/v3-responses/deep_think_v3_resp-minimax.md9.3 KB
  • docs/research/v6-responses/gemini-3-deep-think.md9.0 KB
  • install.sh2.8 KB
  • LICENSE1.1 KB
  • README.md19.2 KB
  • scripts/demo.sh2.9 KB
  • scripts/generate_samples.rs15.7 KB
  • scripts/pre-release.sh7.0 KB
  • src/cache.rs18.8 KB
  • src/cli.rs16.7 KB
  • src/config_resolver.rs36.0 KB
  • src/config.rs20.9 KB
  • src/content_filter.rs38.1 KB
  • src/diff.rs21.1 KB
  • src/fences.rs8.7 KB
  • src/file_utils.rs76.6 KB
  • src/languages.rs3.9 KB
  • src/lib.rs110.4 KB
  • src/main.rs73 B
  • src/markdown.rs105.1 KB
  • src/state.rs30.5 KB
  • src/token_count.rs12.3 KB
  • src/tree_sitter/language_support.rs6.2 KB
  • src/tree_sitter/languages/c.rs17.7 KB
  • src/tree_sitter/languages/cpp.rs25.2 KB
  • src/tree_sitter/languages/go.rs15.3 KB
  • src/tree_sitter/languages/java.rs20.2 KB
  • src/tree_sitter/languages/javascript.rs13.3 KB
  • src/tree_sitter/languages/mod.rs3.9 KB
  • src/tree_sitter/languages/python.rs12.6 KB
  • src/tree_sitter/languages/rust.rs30.6 KB
  • src/tree_sitter/languages/typescript.rs35.3 KB
  • src/tree_sitter/mod.rs8.2 KB
  • src/tree_sitter/signatures.rs7.3 KB
  • src/tree_sitter/structure.rs2.6 KB
  • src/tree_sitter/truncation.rs4.5 KB
  • src/tree.rs10.6 KB
  • tarpaulin.toml304 B
  • tests/cli_integration.rs20.2 KB
  • tests/diff_integration.rs1.1 KB
  • tests/test_auto_diff.rs35.1 KB
  • tests/test_binary_file_autodiff.rs8.5 KB
  • tests/test_comprehensive_edge_cases.rs25.1 KB
  • tests/test_config_resolution.rs22.3 KB
  • tests/test_content_filter.rs14.7 KB
  • tests/test_cwd_independence.rs13.6 KB
  • tests/test_determinism.rs22.7 KB
  • tests/test_file_metadata.rs8.6 KB
  • tests/test_filter_b1.rs5.2 KB
  • tests/test_inclusion.rs12.9 KB
  • tests/test_noninteractive_prompts.rs14.3 KB
  • tests/test_parallel_memory.rs9.3 KB
  • tests/test_phase4_integration.rs11.3 KB
  • winget/manifests/i/igorls/context-builder/0.10.0/igorls.context-builder.installer.yaml623 B
  • winget/manifests/i/igorls/context-builder/0.10.0/igorls.context-builder.locale.en-US.yaml1.7 KB
  • winget/manifests/i/igorls/context-builder/0.10.0/igorls.context-builder.yaml222 B
  • winget/manifests/i/igorls/context-builder/0.8.2/igorls.context-builder.installer.yaml628 B
  • winget/manifests/i/igorls/context-builder/0.8.2/igorls.context-builder.locale.en-US.yaml1.1 KB
  • winget/manifests/i/igorls/context-builder/0.8.2/igorls.context-builder.yaml220 B
  • winget/manifests/i/igorls/context-builder/0.9.0/igorls.context-builder.installer.yaml622 B
  • winget/manifests/i/igorls/context-builder/0.9.0/igorls.context-builder.locale.en-US.yaml1.1 KB
  • winget/manifests/i/igorls/context-builder/0.9.0/igorls.context-builder.yaml222 B

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.

Also: orchestrate the Deep Think Authority handoff so tool-using agents (Antigravity, Gemini Flash, etc.) implement senior one-shot reviews instead of freelancing. Full harness: docs/agent-harness/.

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.10.0)

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 18 other heavy/sensitive directories at any depth. target/ is excluded only at the walk root; nested cache directories are skipped when they contain a CACHEDIR.TAG file
  • Respects .gitignore inside the directory even when no .git is present. Ignore files above the directory apply only when a .git directory or file exists at the directory or an ancestor
  • 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
  • Deep Think → agent pipeline — Package context for Ultra Deep Think, then bind Antigravity/Flash to the resulting AUTHORITY document
  • 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

Deep Think Authority Pipeline (primary multi-model workflow)

Weak agent harnesses (e.g. Gemini Flash in Antigravity) are strong at tools and weak at novel reasoning. Deep Think (Ultra web) is the inverse. Do not try to make Flash invent architecture. Inject Deep Think as law, then let Flash execute.

context-builder  →  Deep Think (AUTHORITY)  →  Agent BUILD  →  RESULT
                         ↑                         │
                         └──── CONFLICT / DEBUG ────┘

Agent rules (always)

  1. AUTHORITY is law — do not redesign, re-prioritize, or “improve” beyond the packet
  2. Stop on conflict — if the live repo contradicts AUTHORITY, emit CONFLICT; do not freestyle
  3. Do not re-inject the full context dump into the agent — Deep Think already distilled it; the agent should use tools on the real tree
  4. Prefer a tight AUTHORITY (≈2–4k tokens): verdict, ordered file-level steps, verification commands
  5. Verification is mandatory before DONE

Step-by-step

# 0) Size check
context-builder -d /abs/path/to/project --token-count

# 1) Package for Deep Think (adjust -f to the language)
mkdir -p docs/handoffs/$(date +%Y-%m-%d)-topic
context-builder -d /abs/path/to/project \
  -f rs,toml,md \
  --max-tokens 120000 \
  -y -o docs/handoffs/$(date +%Y-%m-%d)-topic/00-context.md
  1. Deep Think (Ultra web): attach 00-context.md, paste docs/agent-harness/templates/01-problem.md, require AUTHORITY shape from 02-authority.md.
  2. Human: trim fluff → save 02-authority.md (budget beats volume for Flash).
  3. Agent: load system prompt from docs/agent-harness/antigravity-system-prompt.md; paste 03-build.md with AUTHORITY inlined or path-referenced.
  4. Agent returns RESULT (04-result.md) or CONFLICT (05-conflict.md).
  5. Optional second Deep Think pass: context-builder -d ... -y --diff-only after implementation.

Harness overview, attention budget, and re-escalation table: docs/agent-harness/README.md.

What this changes about Flash’s behavior

Without AUTHORITYWith engineered AUTHORITY
Invents architecture mid-taskExecutes ordered steps
Thrash-refactors “while here”Surgical diffs only
Vague “done”Verification commands required
Silent plan failureCONFLICT stop → re-escalate

It does not give Flash Deep Think’s raw intelligence. It meaningfully raises implementation fidelity when AUTHORITY is high quality.

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 both directories (comma-separated, same as repeated -i)
  • Patterns are gitignore-style: names (docs), paths (crates/core), and globs ('*.lock', quoted so the shell does not expand them)

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:

FeatureBehavior
Auto-ignorenode_modules, dist, build, __pycache__, .venv, vendor, and 13 more heavy dirs are excluded at any depth. target is excluded only at the project root. Directories containing a CACHEDIR.TAG file are skipped
Self-exclusionThe resolved output path (not every file named output.md), earlier reports with this tool's header, the cache dir, and context-builder.toml are auto-excluded
.gitignoreFiles inside the directory are respected even when it is not a git checkout. Parent ignore files apply only when a .git directory or file exists at the directory or an ancestor
Binary detectionBinary files are skipped via UTF-8 sniffing
Asset / size / secret skipsImages (incl. SVG), fonts, media, archives, PDFs, compiled objects, wasm, weights, *.min.js, and *.map are omitted; files over 256 KiB are omitted (--max-file-size 0 disables); id_rsa, *.pem, credentials*.json, .env (not .env.example) are omitted. See README "Default skips"
File orderingRoot README, then root manifests/docs → source grouped by directory (manifest/README, then entry points) → tests → docs (CHANGELOG/HISTORY included) → build/CI. Lockfiles omitted unless --include-lockfiles.

CLI Reference (Agent-Relevant Flags)

FlagPurposeAgent Guidance
-d <PATH>Input directoryAlways use absolute paths for reliability
-o <FILE>Output pathWrite to project docs/ or /tmp/
-f <EXT>Filter by extensionComma-separated: -f rs,toml,md
-i <PATTERN>Ignore paths or gitignore globsComma-separated (-i docs,assets) or repeated (-i '*.lock' -i crates/core)
--max-tokens <N>Token budget capUse 100000 for most models, 200000 for Gemini
--token-countDry-run token estimateRun first to check if filtering is needed
-ySkip all promptsUse only with explicit, scoped project paths
--previewShow file tree onlyQuick exploration without generating output
--diff-onlyOutput only diffsMinimizes tokens for incremental updates
--signaturesAST signature extractionRequires tree-sitter-all feature at install
--structureStructural summaryPair with --signatures for compact output
--visibility <V>Filter by visibilityall (default), public (public API only)
--truncate <MODE>Truncation strategy for --max-tokenssmart (AST-aware) or byte
--max-file-size <SIZE>Skip files over SIZE (256K default; 0 disables)Raise for a large source file you filtered in
--hiddenInclude dotfiles and dot-directoriesDoes not enter .git and does not include secrets
--include-secretsInclude likely-secret filesCombine with --hidden for .env
--initCreate config fileAuto-detects project file types
--clear-cacheReset diff cacheUse if diff output seems stale

Recipes

Recipe: Deep Think Code Review (one-shot only)

context-builder -d /path/to/project -f rs,toml --max-tokens 120000 -y -o docs/deep_think_context.md
# Attach to Deep Think + a structured review prompt (see docs/research/prompts/)

For review → implement (Deep Think then Antigravity), use the Deep Think Authority Pipeline above, not a freeform paste.

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<()>
pub fn generate_markdown_with_diff(...) -> Result<String>
```

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

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

このスキルの問題を報告する