open-context-engine-skill 一个工业级的、开源 Augment Context Engine(ACE)实现
一个工业级的、开源的 Augment Context Engine(ACE)实现
open-context-engine-skill
An industrial-grade, open-source implementation of Augment’s Context Engine (ACE).
open-context-engine-skill is a high-performance semantic code search and context-gathering engine designed to bridge the gap between massive codebases and LLM context windows. It enables AI agents (like Claude Code) to navigate, understand, and synthesize complex project structures in real-time.
🚀 Key Features
- Zero-Dependency Core: Written entirely in Python 3 using only the Standard Library. No
pip installrequired—maximum portability for any environment. - Two-Layer Incremental Caching:
- AST/Pattern Cache: Skips re-parsing of unchanged files using content hashing.
- Semantic Score Cache: Persistent SQLite-based storage (
.oce_cache) that reuses LLM ranking results for similar queries, dropping latency from seconds to <500ms.
- Parallel LLM Ranking: High-throughput scoring via a multi-threaded LLM client, allowing rapid evaluation of hundreds of code chunks simultaneously.
- Multi-Language Intelligence:
- Python: Deep AST-based extraction.
- Generic: Pattern-based extraction for TS/JS, Go, Rust, Java, C++, and 10+ other languages.
- Git-Aware Filtering: Automatically respects
.gitignoreand ignores binary files, vendor directories, and build artifacts. - Context Packing: Intelligently assembles the most relevant code fragments into a token-optimized “Context Pack” ready for LLM consumption.
🛠 Installation
-
Clone the repository:
git clone https://github.com/your-username/open-context-engine-skill.git cd open-context-engine-skill -
Configure API Access:
Create a config file atopen-context-engine-skill/.config/open-context-engine/config.json:{ "api_url": "https://api.openai.com/v1", "api_key": "your-api-key", "model": "gpt-oss-120b", "max_tokens": 8000 }
📖 Usage
Command Line Interface
Run a semantic search against any project:
python scripts/search_context.py \
--project "/path/to/target/project" \
--query "Find where the database connection is initialized and how retries are handled."
Integration with AI Tools (Claude Code)
This engine is designed to be used as a Skill. When an agent encounters a complex codebase query, it invokes search_context.py to retrieve the most relevant logic:
- [search-mode]: Exhaustive search across the codebase using parallel agents and AST-aware tools.
- [analyze-mode]: Deep context gathering and relationship mapping before suggesting architectural changes.
🏗 Architecture
The engine follows a strictly optimized pipeline:
- File Collector: Scans the project, applying Git rules and detecting binary files.
- Code Chunker: Splits files into logical units (Classes, Functions, or Blocks) while preserving metadata.
- Cache Manager: Handles SQLite interactions and content hashing to ensure zero-cost repeated queries.
- Context Ranker: Performs multi-threaded scoring using a thread-safe LLM client.
- Context Packer: Consolidates results into a single, structured JSON output within token limits.
🛡 Performance
| Project Size | Cold Search (Initial) | Hot Search (Cached) |
|---|---|---|
| Small (<100 files) | ~20-40ms | ~15ms |
| Medium (~500 files) | ~80-120ms | ~35ms |
| Large (>1000 files) | ~1s+ | ~35ms |
更多推荐




所有评论(0)