Skip to content

Enhance Pilot documentation and integrate intelligent navigation features#2

Merged
zTgx merged 10 commits intomainfrom
dev
Apr 4, 2026
Merged

Enhance Pilot documentation and integrate intelligent navigation features#2
zTgx merged 10 commits intomainfrom
dev

Conversation

@zTgx
Copy link
Copy Markdown
Member

@zTgx zTgx commented Apr 4, 2026

No description provided.

zTgx added 10 commits April 4, 2026 12:54
…g process

Add detailed documentation covering the three-layer information architecture that powers
the Pilot system's decision-making capabilities.

The new documentation includes:

- Information source architecture with TOC View as the core navigation map
- Detailed explanation of the three-tier structure: TOC View (global map),
  Current Path (current location), and Candidates Detail (candidate options)
- Visual diagrams illustrating the decision-making flow from user query to
  LLM decision
- Step-by-step example showing how Pilot processes a PostgreSQL connection pool
  configuration query
- Key insights about the importance of summary quality in the Index phase
- Token budget allocation strategy for ContextBuilder with dynamic adjustment
  mechanisms

This documentation provides a complete reference for understanding how Pilot
uses multi-layered context information to make intelligent navigation decisions.
- Introduce PilotConfig with modes (Aggressive, Balanced, Conservative, AlgorithmOnly)
- Add BudgetConfig for controlling token/call limits during retrieval
- Implement InterventionConfig with thresholds for smart intervention points
- Create PilotDecision type with ranked candidates and search directions
- Add SearchState for tracking search context and progress
- Implement NoopPilot for testing and fallback scenarios
- Define Pilot trait with should_intervene and decide methods
- Add InterventionPoint enum for different decision timing
- Export all Pilot-related types through main module
- Add Pilot integration to BeamSearch algorithm with semantic guidance
  at fork points and decision moments
- Implement score merging function that combines algorithmic scoring
  with Pilot decisions using weighted combination (α=0.4, β=0.6)
- Add pilot intervention tracking and consultation logic during search
- Include start guidance feature when Pilot is configured to guide
- Add visited nodes tracking to prevent cycles during search

refactor(search): update search trait with Pilot parameter

- Modify SearchTree trait to accept optional Pilot parameter in search method
- Add pilot_interventions field to SearchResult struct to track interventions
- Provide default implementation for search_without_pilot method
- Document Pilot integration points in trait documentation

feat(stages): add Pilot support to search stage pipeline

- Integrate Pilot instance into SearchStage with with_pilot method
- Add pilot availability check through has_pilot method
- Update search execution to pass Pilot reference to algorithms
- Add logging for pilot-enabled searches and intervention counts
- Initialize pilot reset before each search execution

refactor(search): add Pilot placeholders to greedy and mcts algorithms

- Update GreedySearch and MctsSearch implementations to accept Pilot parameter
- Add placeholder comments for future Pilot integration in Phase 2
- Maintain backward compatibility with existing functionality
- Introduce BudgetController to track token consumption and call counts
  for Pilot LLM calls, enforcing budget limits to control costs during
  retrieval operations
- Add BudgetUsage struct for tracking input/output tokens and call
  statistics with utilization metrics
- Implement thread-safe atomic counters and level-based call limiting
- Create ContextBuilder for constructing structured LLM contexts with
  token budget distribution across query, path, candidates, and TOC
  sections
- Add PilotContext struct for formatted context sections with token
  estimation
- Include comprehensive test coverage for both budget and context
  building functionality
- Register budget module in pilot mod.rs and expose public API
- Implement LlmPilot struct with LLM client integration
- Add budget control and context building capabilities
- Include prompt building and response parsing functionality
- Provide comprehensive test coverage for new implementation

refactor(budget): improve test assertions and clarity

- Store config value in variable for better readability in tests
- Update cost estimation tests with more accurate expectations
- Add detailed comments explaining token calculation logic

refactor(builder): update test methods and documentation

- Change method calls to use proper error handling without unwrap
- Update DocumentTree creation to use from_raw method
- Modify query section truncation test with clearer budget explanation

refactor(parser): enhance regex parsing safety

- Add proper bounds checking for candidate indexing
- Wrap unsafe operations in appropriate conditionals
- Improve error handling for parsing edge cases

refactor(prompts): optimize token estimation

- Pre-calculate token estimates in build methods
- Remove redundant calculations for improved performance
- Maintain same functionality with cleaner code structure

refactor(templates): simplify default implementations

- Replace hardcoded string includes with fallback methods
- Remove unused NodeId import from templates module
- Streamline template initialization logic
- Implement FallbackManager with 4-level fallback strategy:
  - Normal LLM call
  - Retry with exponential backoff
  - Simplified context (reduce tokens)
  - Algorithm-only mode (no LLM)

- Add comprehensive fallback types: Network, RateLimited,
  TokenLimitExceeded, Unavailable, ParseError

- Create MetricsCollector for tracking Pilot operations:
  - LLM call statistics (count, success/failure)
  - Token usage (input, output, total)
  - Latency tracking (average, p50, p99)
  - Decision quality metrics

- Register new modules in pilot mod.rs
…dance

- Introduce Pilot trait and SearchState for navigation guidance in retrieval pipeline
- Add optional Pilot field to PipelineContext for providing intelligent backtrack guidance
- Implement with_pilot method in PipelineContext to create context with Pilot instance

- Integrate Pilot into RetrievalOrchestrator with configurable backtrack guidance
- Add pilot consultation during backtracking to suggest alternative search paths
- Include candidate node mapping and confidence-based ranking from Pilot guidance

- Enhance orchestrator execution flow to use Pilot for intelligent search path decisions
- Add debug logging for Pilot guidance operations and confidence levels
- Support both implicit and explicit backtrack scenarios with Pilot integration
- Add comprehensive documentation section for Pilot component explaining its role as the
  intelligence layer in the retrieval system
- Document intervention points (START, FORK, BACKTRACK, EVALUATE) where Pilot acts
- Include score merging formula combining algorithm and LLM scores
- Add fallback strategy explanation with 4-level degradation approach
- Create detailed SVG architecture diagram showing Pilot's relationship to retrieval pipeline
- Illustrate intervention points with visual flow and design philosophy
- Update package version from 0.1.9 to 0.1.10 in Cargo.toml
@zTgx zTgx merged commit 49fcede into main Apr 4, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant