44PowerShell completion module combining Tab completion (NativeAOT) + inline predictions (managed DLL) with generic learning and cross-session persistence.
55
66** Key Features** :
7- - ** Parameter-Value Binding** : Understands parameter-value relationships (e.g., ` -f net6.0 ` ), provides context-aware suggestions (Phase 20)
7+ - ** Parameter-Value Binding** : Understands parameter-value relationships (e.g., ` -f net6.0 ` ), provides context-aware suggestions
88- ** Generic Learning** : Learns from ALL commands (not just predefined ones) with context-aware suggestions
99- ** Partial Command Predictions** : Frequency-based command suggestions as you type (e.g., "g" → "git", "gh", "gt")
1010- ** Multi-Word Suggestions** : Shows common argument combinations (e.g., "git checkout master")
1111- ** Workflow Learning** : Learns command sequences and predicts next command based on usage patterns
1212- ** Cross-Session Persistence** : SQLite database stores learned data across sessions
1313- ** Directory-Aware Navigation** : Smart cd/Set-Location suggestions with path normalization and symlink resolution
14- - ** Symlink Deduplication** : Resolves symlinks, junctions, and directory links to prevent duplicate suggestions (Phase 21.1)
14+ - ** Symlink Deduplication** : Resolves symlinks, junctions, and directory links to prevent duplicate suggestions
1515- ** ML Sequence Prediction** : N-gram based next-command prediction
1616- ** Privacy Protection** : Filters sensitive data (passwords, tokens, keys)
17- - ** PowerShell Module Functions** : 14 functions for learning , database, workflow management, and smart navigation (no IPC overhead)
17+ - ** PowerShell Module Functions** : Learning , database, workflow management, and smart navigation
1818- ** Smart Directory Navigation** : ` pcd ` command with inline predictions, relative paths, fuzzy matching, frecency scoring, and best-match navigation
1919
20- ** Supported Commands** : git, gh, gt (Graphite), az, azd, func, code, scoop, winget, wt (Windows Terminal), chezmoi, tre, lsd, dust, cd/Set-Location
20+ ** Supported Commands** : git, gh, gt (Graphite), az, azd, func, code, scoop, winget, wt (Windows Terminal), chezmoi, tre, lsd, dust, claude, cd/Set-Location
2121
2222For completed work history, see docs/COMPLETED.md.
2323
@@ -26,11 +26,11 @@ For completed work history, see docs/COMPLETED.md.
2626- ** Module** (` PSCue.Module.dll ` ): Long-lived, implements ` ICommandPredictor ` + ` IFeedbackProvider ` (7.4+), provides PowerShell module functions
2727- ** Learning System** :
2828 - ** CommandHistory** : Ring buffer tracking last 100 commands
29- - ** CommandParser** : Parses commands into typed arguments (Verb, Flag, Parameter, ParameterValue, Standalone) (Phase 20)
29+ - ** CommandParser** : Parses commands into typed arguments (Verb, Flag, Parameter, ParameterValue, Standalone)
3030 - ** ArgumentGraph** : Knowledge graph of command → arguments with frequency + recency scoring
3131 - ** ArgumentSequences** : Tracks consecutive argument pairs for multi-word suggestions (up to 50 per command)
32- - ** ParameterStats** : Tracks parameters and their known values (Phase 20)
33- - ** ParameterValuePairs** : Tracks bound parameter-value pairs (Phase 20)
32+ - ** ParameterStats** : Tracks parameters and their known values
33+ - ** ParameterValuePairs** : Tracks bound parameter-value pairs
3434 - ** ContextAnalyzer** : Detects command sequences and workflow patterns
3535 - ** SequencePredictor** : ML-based n-gram prediction for next commands
3636 - ** WorkflowLearner** : Learns command → next command transitions with timing data
6262## Key Files & Line References
6363- ` src/PSCue.Module/ModuleInitializer.cs ` : Module lifecycle, subsystem registration
6464- ` src/PSCue.Module/PSCueModule.cs ` : Static module state container for PowerShell functions
65- - ` src/PSCue.Module/CommandParser.cs ` : Command line parser for parameter-value binding (Phase 20)
66- - ` src/PSCue.Module/ArgumentGraph.cs ` : Knowledge graph with path normalization + symlink resolution + argument sequences + parameter tracking (Phase 21.1)
65+ - ` src/PSCue.Module/CommandParser.cs ` : Command line parser for parameter-value binding
66+ - ` src/PSCue.Module/ArgumentGraph.cs ` : Knowledge graph with path normalization + symlink resolution + argument sequences + parameter tracking
6767- ` src/PSCue.Module/GenericPredictor.cs ` : Context-aware suggestions (values only after parameters, multi-word support)
6868- ` src/PSCue.Module/CommandPredictor.cs ` : Hybrid predictor with multi-word Combine support
6969- ` src/PSCue.Module/SequencePredictor.cs ` : N-gram ML prediction for command sequences
7070- ` src/PSCue.Module/WorkflowLearner.cs ` : Dynamic workflow learning with timing-aware predictions
7171- ` src/PSCue.Module/PersistenceManager.cs ` : SQLite-based cross-session persistence with 10 tables
72- - ` src/PSCue.Module/PcdCompletionEngine.cs ` : Enhanced PCD algorithm with fuzzy matching, frecency scoring, filesystem search, symlink resolution (Phases 17.6 + 17.9 + 19.0 + 21.1)
73- - ` src/PSCue.Module/PcdConfiguration.cs ` : Shared configuration for PCD (tab completion + predictor) (Phase 19.0 + 21.2)
72+ - ` src/PSCue.Module/PcdCompletionEngine.cs ` : Enhanced PCD algorithm with fuzzy matching, frecency scoring, filesystem search, symlink resolution
73+ - ` src/PSCue.Module/PcdConfiguration.cs ` : Shared configuration for PCD (tab completion + predictor)
7474- ` src/PSCue.Module/PcdInteractiveSelector.cs ` : Interactive directory selection with visual styling (color-coded indicators, decorative UI, ASCII fallback for non-UTF-8 consoles)
7575- ` src/PSCue.Module/FeedbackProvider.cs ` : Learns from command execution, records navigation paths with trailing separators
7676- ` src/PSCue.Shared/CommandCompleter.cs ` : Completion orchestration
7777- ` module/Functions/LearningManagement.ps1 ` : PowerShell functions for learning system
7878- ` module/Functions/DatabaseManagement.ps1 ` : PowerShell functions for database queries
79- - ` module/Functions/WorkflowManagement.ps1 ` : PowerShell functions for workflow management (Phase 18.1)
80- - ` module/Functions/PCD.ps1 ` : PowerShell smart directory navigation function (Phases 17.5 + 17.6 + 17.9)
79+ - ` module/Functions/WorkflowManagement.ps1 ` : PowerShell functions for workflow management
80+ - ` module/Functions/PCD.ps1 ` : PowerShell smart directory navigation function
8181- ` module/Functions/Debugging.ps1 ` : PowerShell functions for testing/diagnostics
8282- ` test/PSCue.Module.Tests/ArgumentGraphTests.cs ` : Argument graph + sequence tracking tests
8383- ` test/PSCue.Module.Tests/GenericPredictorTests.cs ` : Generic predictor + multi-word tests
8484- ` test/PSCue.Module.Tests/CommandPredictorTests.cs ` : Command predictor + Combine tests
8585- ` test/PSCue.Module.Tests/SequencePredictorTests.cs ` : N-gram predictor unit tests
86- - ` test/PSCue.Module.Tests/WorkflowLearnerTests.cs ` : Workflow learning tests (Phase 18.1)
87- - ` test/PSCue.Module.Tests/PCDTests.cs ` : Smart directory navigation tests (Phase 17.5)
88- - ` test/PSCue.Module.Tests/PcdEnhancedTests.cs ` : Enhanced PCD algorithm tests with symlink resolution (Phases 17.6 + 17.9 + 21.1 + 21.2)
86+ - ` test/PSCue.Module.Tests/WorkflowLearnerTests.cs ` : Workflow learning tests
87+ - ` test/PSCue.Module.Tests/PCDTests.cs ` : Smart directory navigation tests
88+ - ` test/PSCue.Module.Tests/PcdEnhancedTests.cs ` : Enhanced PCD algorithm tests with symlink resolution
8989- ` test/PSCue.Module.Tests/PcdMatchScoreTests.cs ` : Unit tests for CalculateMatchScore directory name matching
9090- ` test/PSCue.Module.Tests/PcdRobustnessTests.cs ` : Tests for handling stale/non-existent paths gracefully
9191- ` test/PSCue.Module.Tests/PcdInteractiveSelectorTests.cs ` : Unit tests for interactive directory selection
9595
9696## Common Tasks
9797``` bash
98- # Build
98+ # Build (requires .NET 10.0 SDK — ArgumentCompleter targets net10.0, Module targets net9.0)
9999dotnet build src/PSCue.Module/ -c Release -f net9.0
100100dotnet publish src/PSCue.ArgumentCompleter/ -c Release -r win-x64
101101
@@ -120,7 +120,7 @@ dotnet test --filter "FullyQualifiedName~WorkflowLearner"
120120# Import-Module "D:\temp\PSCue-dev\PSCue.psd1"
121121# Cleanup: Remove-Item -Recurse -Force D:\temp\PSCue-dev
122122
123- # PowerShell Module Functions (Phase 16 - replaces PSCue.Debug)
123+ # PowerShell Module Functions
124124# Learning Management (in-memory + database)
125125Get-PSCueLearning [-Command < string> ] [-AsJson] # View learned data (in-memory)
126126Clear-PSCueLearning [-Force] [-WhatIf] [-Confirm] # Clear learned data (memory + DB), -Force to delete DB directly
@@ -132,15 +132,16 @@ Save-PSCueLearning # Force save to disk
132132Get-PSCueDatabaseStats [-Detailed] [-AsJson] # Database stats (reads DB directly)
133133Get-PSCueDatabaseHistory [-Last < n> ] [-Command < name> ] [-AsJson] # Query DB history
134134
135- # Workflow Management (Phase 18.1)
135+ # Workflow Management
136136Get-PSCueWorkflows [-Command < string> ] [-AsJson] # View learned workflows
137137Get-PSCueWorkflowStats [-Detailed] [-AsJson] # Workflow statistics
138138Clear-PSCueWorkflows [-WhatIf] [-Confirm] # Clear workflows (memory + DB)
139139Export-PSCueWorkflows -Path < path> # Export workflows to JSON
140140Import-PSCueWorkflows -Path < path> [-Merge] # Import workflows from JSON
141141
142- # Smart Directory Navigation (Phases 17.5 + 17.6 + 17.7 + 17.9 + 19.0 + Bug Fixes + Native cd Behavior + Interactive Mode)
142+ # Smart Directory Navigation
143143pcd [path] # PowerShell Change Directory with inline predictions + tab completion
144+ pcd - # Navigate to previous directory (like cd - in bash)
144145pcd -Interactive [path] [-Top < int> ] # Interactive selection menu (alias: -i), optional path filter
145146pcd -Root # Navigate to git repository root (alias: -r); filesystem root if not in a repo
146147Invoke-PCD [path] # Long-form function name
@@ -180,33 +181,33 @@ Invoke-PCD [path] # Long-form function name
180181# - Path normalization: All paths end with trailing \ to prevent duplicates
181182# - Well-known shortcuts: ~, .. (only suggested for relative paths, not absolute)
182183# - Performance: <50ms tab completion, <10ms predictor
183- # - Code sharing: Unified configuration via PcdConfiguration class (Phase 19.0)
184+ # - Code sharing: Unified configuration via PcdConfiguration class
184185# - Robustness: Handles stale database entries, race conditions, and permission issues gracefully
185186
186- # Algorithm (Phase 17.6 + 17.9 + 19.0 + 21.2 + Bug Fixes - PcdCompletionEngine):
187+ # Algorithm (PcdCompletionEngine):
187188# - Stage 1: Well-known shortcuts (~, ..) - skipped for absolute paths
188189# - Stage 2: Learned directories (searches top 200 paths for better coverage)
189- # - Directory name matching: Checks both full path AND directory name for matches (PcdCompletionEngine.cs:559-589)
190+ # - Directory name matching: Checks both full path AND directory name for matches
190191# - Exact match boost: 100× multiplier ensures exact matches always appear first
191- # - Cache filtering: Filters .codeium, .claude, .dotnet, node_modules, bin, obj, etc. (Phase 21.2)
192+ # - Cache filtering: Filters .codeium, .claude, .dotnet, node_modules, bin, obj, etc.
192193# - Parent directory filtered for absolute paths
193194# - Stage 3a: Direct filesystem search (non-recursive) - always enabled
194195# - Cache filtering: Applied to discovered directories
195196# - Stage 3b: Recursive filesystem search - ALWAYS enabled when configured (depth-controlled)
196197# - Tab completion: maxDepth=3 (thorough, can afford deeper search)
197198# - Inline predictor: maxDepth=1 (fast, shallow search only)
198199# - Cache filtering: Applied to recursively discovered directories
199- # - Cache/metadata filtering (Phase 21.2) : Blocklisted directories are filtered UNLESS explicitly typed
200+ # - Cache/metadata filtering: Blocklisted directories are filtered UNLESS explicitly typed
200201# - Default blocklist: .codeium, .claude, .dotnet, .nuget, .git, .vs, .vscode, .idea, node_modules, bin, obj, target, __pycache__, .pytest_cache
201202# - Explicit typing overrides: typing ".claude" will show .claude directories
202203# - Configurable via PSCUE_PCD_ENABLE_DOT_DIR_FILTER and PSCUE_PCD_CUSTOM_BLOCKLIST
203- # - Fuzzy matching (Phase 21.4) : Substring + Levenshtein with quality controls
204+ # - Fuzzy matching: Substring + Levenshtein with quality controls
204205# - Minimum similarity threshold: 70% (configurable via PSCUE_PCD_FUZZY_MIN_MATCH_PCT)
205206# - Long query protection (>10 chars): Requires 60% continuous substring overlap (LCS algorithm)
206207# - Prevents unrelated matches (e.g., "dd-trace-js" won't match "dd-trace-dotnet")
207208# - Frecency scoring: Configurable blend (default: 50% frequency, 30% recency, 20% distance)
208209# - Distance scoring: Parent (0.9), Child (0.85-0.5), Sibling (0.7), Ancestor (0.6-0.1)
209- # - Tab completion display (module/Functions/PCD.ps1:183-228 ):
210+ # - Tab completion display (module/Functions/PCD.ps1):
210211# - CompletionText: Relative paths with .\ prefix for child dirs, ..\ for siblings, absolute for others
211212# - ListItemText: Clean names (e.g., "Screenshots" not ".\Screenshots\")
212213# - Single quotes for paths with spaces, platform-appropriate separators
@@ -227,7 +228,7 @@ Get-PSCueModuleInfo [-AsJson] # Module diagnostics
2272283 . ** ArgumentCompleter computes locally** : Tab completion always computes locally with full dynamic arguments. Fast enough (<50ms) and simpler.
2282294 . ** NestedModules in manifest** : Required for ` IModuleAssemblyInitializer ` to trigger
2292305 . ** Concurrent logging** : ` FileShare.ReadWrite ` + ` AutoFlush ` for multi-process debug logging
230- 6 . ** PowerShell module functions** : Direct in-process access, no IPC overhead (Phase 16)
231+ 6 . ** PowerShell module functions** : Direct in-process access, no IPC overhead
231232
232233## Performance Targets
233234- ArgumentCompleter startup: <10ms
@@ -238,7 +239,7 @@ Get-PSCueModuleInfo [-AsJson] # Module diagnostics
238239- PCD best-match navigation: <50ms
239240
240241## Supported Commands
241- git, gh, gt, az, azd, func, code, scoop, winget, wt, chezmoi, tre, lsd, dust, cd (Set-Location/sl/chdir)
242+ git, gh, gt, az, azd, func, code, scoop, winget, wt, chezmoi, tre, lsd, dust, claude, cd (Set-Location/sl/chdir)
242243
243244** Git Completion Features** :
244245- Hardcoded subcommands with detailed tooltips (add, commit, branch, etc.)
@@ -286,7 +287,7 @@ public void TestLearningAccess()
2862879 . ** Path normalization requires workingDirectory** : When calling ` ArgumentGraph.RecordUsage() ` for navigation commands (cd, sl, chdir), MUST provide the ` workingDirectory ` parameter. If null/empty, path normalization (including symlink resolution) is skipped. This causes duplicate entries for symlinked paths. Always pass a valid working directory for proper deduplication.
28728810 . ** PCD best-match returns 0 suggestions** : If ` GetSuggestions() ` returns no matches, check that ` GetLearnedDirectories() ` is requesting enough paths from ArgumentGraph. The default pool size should be 200+ to ensure less-frequently-used directories are searchable. Also verify ` CalculateMatchScore() ` checks BOTH full paths and directory names.
28828911 . ** PCD attempts Set-Location on non-existent path** : Always loop through ALL suggestions and verify existence before navigation. Never call ` Set-Location ` on paths that don't exist - show helpful error messages instead. This handles race conditions and stale database entries gracefully.
289- 12 . ** PCD tab completion behavior** : CompletionText must match native cd exactly - use .\ prefix for child directories, ..\ for siblings, and single quotes for spaces. ListItemText should be clean (no prefixes/separators/quotes). See module/Functions/PCD.ps1:183-228 for implementation.
290+ 12 . ** PCD tab completion behavior** : CompletionText must match native cd exactly - use .\ prefix for child directories, ..\ for siblings, and single quotes for spaces. ListItemText should be clean (no prefixes/separators/quotes). See module/Functions/PCD.ps1 for implementation.
29029113 . ** Testing with non-existent paths** : Use ` skipExistenceCheck: true ` parameter in ` PcdCompletionEngine.GetSuggestions() ` when testing with mock/non-existent paths. Production code filters non-existent paths by default.
29129214 . ** Release builds missing dependencies** : The release workflow (.github/workflows/release.yml) MUST use ` dotnet publish ` (not ` dotnet build ` ) for PSCue.Module to include all dependencies, especially the ` runtimes/ ` directory with native SQLite libraries. ` dotnet build ` only outputs primary assemblies, while ` dotnet publish ` creates a complete deployable package. The remote install script (install-remote.ps1) recursively copies all directories from the release archive to handle ` runtimes/ ` , ` Functions/ ` , and any future subdirectories.
29229315 . ** install-local.ps1 dependency list** : The local install script has a hardcoded ` $Dependencies ` array listing DLLs to copy from the ` publish/ ` directory. When adding new NuGet packages (e.g., Spectre.Console), you MUST add the DLL to this list or the module will fail at runtime with assembly-not-found errors. Consider replacing this with a bulk copy approach (like ` install-remote.ps1 ` does) to avoid this pitfall.
@@ -296,8 +297,8 @@ public void TestLearningAccess()
296297
297298## Documentation
298299- ** Implementation status** :
299- - Active work: See ` TODO.md ` (includes detailed Phase 18 workflow improvements roadmap)
300- - Completed phases : See ` docs/COMPLETED.md ` (Phases 1-21 archived, includes all PCD quality improvements)
300+ - Active work: See ` TODO.md `
301+ - Completed work : See ` docs/COMPLETED.md `
301302- ** Database functions** : See ` docs/DATABASE-FUNCTIONS.md ` for detailed SQLite query examples and schema
302303- ** Troubleshooting** : See ` docs/TROUBLESHOOTING.md ` for common issues and solutions
303304- Bug fix history: See git log and commit messages
@@ -318,21 +319,21 @@ $env:PSCUE_MAX_COMMANDS = "500" # Max commands to track
318319$env:PSCUE_MAX_ARGS_PER_CMD = "100" # Max arguments per command
319320$env:PSCUE_DECAY_DAYS = "30" # Score decay period (days)
320321
321- # ML prediction configuration (Phase 17.1: N-gram sequence predictor)
322+ # ML prediction configuration
322323$env:PSCUE_ML_ENABLED = "true" # Enable ML sequence predictions (default: true)
323324$env:PSCUE_ML_NGRAM_ORDER = "2" # N-gram order: 2=bigrams, 3=trigrams (default: 2)
324325$env:PSCUE_ML_NGRAM_MIN_FREQ = "3" # Minimum frequency to suggest (default: 3 occurrences)
325326
326- # Workflow learning configuration (Phase 18.1: Dynamic workflow learning)
327+ # Workflow learning configuration
327328$env:PSCUE_WORKFLOW_LEARNING = "true" # Enable workflow learning (default: true)
328329$env:PSCUE_WORKFLOW_MIN_FREQUENCY = "5" # Min occurrences to suggest (default: 5)
329330$env:PSCUE_WORKFLOW_MAX_TIME_DELTA = "15" # Max minutes between commands (default: 15)
330331$env:PSCUE_WORKFLOW_MIN_CONFIDENCE = "0.6" # Min confidence threshold (default: 0.6)
331332
332- # Partial command predictions (Phase 17.8: Frequency-based command suggestions)
333+ # Partial command predictions
333334$env:PSCUE_PARTIAL_COMMAND_PREDICTIONS = "true" # Enable partial command predictions (default: true)
334335
335- # PCD (Smart Directory Navigation) configuration (Phases 17.5-17.9 + 19.0 + 21.2 + 21.3 + 21.4)
336+ # PCD (Smart Directory Navigation) configuration
336337$env:PSCUE_PCD_FREQUENCY_WEIGHT = "0.5" # Frecency scoring: frequency weight (default: 0.5)
337338$env:PSCUE_PCD_RECENCY_WEIGHT = "0.3" # Frecency scoring: recency weight (default: 0.3)
338339$env:PSCUE_PCD_DISTANCE_WEIGHT = "0.2" # Frecency scoring: distance weight (default: 0.2)
0 commit comments