Skip to content

Intelligent Semantic Chunking & Complete Code Context

Latest

Choose a tag to compare

@Domush Domush released this 21 Nov 19:42
· 2 commits to main since this release

Version 2.0.0 — The Semantic Intelligence Update - Major update!

Release Date: November 21, 2026

🌟 Headline: Intelligent Semantic Chunking & Complete Code Context

Prior to v2.0, large files were cut into chunks based on fixed line and byte boundaries. While fast, this occasionally split functions in half or separated an error message from its stack trace.

v2.0.0 introduces an AST-aware semantic chunking engine (lib/chunker.js). Instead of cutting text arbitrarily, Context Mode understands the structure of code, configs, logs, and prose—ensuring agents receive complete, unbroken methods and sections.


✨ What’s New in 2.0.0

1. Language-Aware Semantic Chunking (15+ Languages)

Context Mode now includes dedicated syntax parsers that respect logical block boundaries:

  • JavaScript & TypeScript (JSX / TSX): Keeps full class bodies, methods, async functions, arrow functions, and JSDoc comment blocks together.
  • Python: Tracks indentation levels, class definitions, method stacks, and docstrings without separating decorators from their functions.
  • Systems & OOP (Java, C#, C, C++, Go, Rust, PHP, Swift, Kotlin, Scala): Tracks brace depth, namespaces, annotations, and struct/implementation blocks.
  • Shell & PowerShell: Preserves function declarations, parameter blocks, and pipeline filters.
  • SQL: Intelligently chunks at statement boundaries (CREATE TABLE, SELECT, stored procedures).

2. Hierarchical Markdown & Document Sectioning

  • Chunks Markdown by heading level (# H1 down to ###### H6).
  • Prepends breadcrumb navigation context (e.g. # Architecture > ## Storage Engine > ### SQLite Schema).
  • Never splits fenced code blocks, tables, or itemized lists across chunks.

3. Structured Configurations & Markup

  • JSON & JSONC: Chunks on top-level keys or array slices, preserving valid JSON objects.
  • YAML: Splits along document dividers (---) and root-level keys.
  • TOML & INI: Keeps section headers ([database]) and key-value groups intact.
  • HTML/XML & CSS/SCSS: Preserves structural tags and stylesheet rules.

4. Stack Trace & Error Log Grouping

  • In log files, multi-line error traces (such as Java, Python, or Node.js at ..., Caused by:) are guaranteed to remain grouped with their originating timestamp and error header in a single chunk.

5. Context-Rich Search Results (ctx_search)

  • Complete Method Delivery: When a matched function or section fits within the 2,048-byte snippet budget, ctx_search returns the entire method intact—no truncated snippets or missing lines.
  • Line Range Metadata: Every search result now includes explicit startLine, endLine, and context scope breadcrumbs (e.g., Lines 42–65 | class FlightComputer > calculateDeltaV()), giving agents instant orientation.

6. SQLite Schema v4

  • Virtual tables chunks (BM25) and chunks_tri (Trigram) now feature unindexed metadata columns for zero-overhead structural tracking, with automatic database migration from previous versions.

📊 Release Summary Matrix

Feature / Capability v1.4.0 v1.5.0 v2.0.0
Tool Read Cutoff & Hook Interception ✅ Dynamic line scaling ✅ Auto-index on hook ✅ Auto-index on hook
File Exemption Controls ✅ 1-click category pills ✅ Injected into agent context ✅ Injected into agent context
Indexing Model Manual (ctx_index) ✅ Just-In-Time (ctx_search) ✅ Just-In-Time (ctx_search)
MCP Tool Surface 8 tools (with ctx_index) ✅ 7 streamlined tools ✅ 7 streamlined tools
Log Search Strategy Standard ✅ Reverse / Tail-First ✅ Tail-First + Stack Trace Grouping
Chunking Engine Byte & line buckets Byte & line buckets ✅ AST & Syntax-Aware Semantic Engine
Code Structure Preservation Partial Partial ✅ 15+ Languages, Classes & Methods Intact
Markdown Chunking Line-based Line-based ✅ Heading Breadcrumbs (# H1 > ## H2)
Search Result Snippets Centered window slice Centered window slice ✅ Complete Intact Method (up to 2 KB)
Search Metadata Score & source Path & score ✅ Lines X–Y, Enclosing Scope Context
SQLite Schema Schema v2 Schema v3 (path PK) ✅ Schema v4 (Unindexed Scope Metadata)