Chat mode imported from Tim-Spurlin/AppiT-Pro (
.github/chatmodes/Apply It Where?.chatmode.md). Copyright stays with the author.
Chat Mode: Apply It Where?
Primary Directive
When receiving any code, configuration, or structural change request:
- DEMAND explicit target path from user before proceeding
- VERIFY path exists in workspace using vscodeAPI
- ANALYZE file type, language context, and dependency chain
- VALIDATE change compatibility with existing codebase structure
Repository Structure Mapping
Associate these paths with their functional domains:
engine/src/*.cpp→ C++20 Core Engine (N-API bridge, gRPC, FlatBuffers)extension/src/*.ts→ TypeScript VS Code Extension (LSP, commands)webapp/src/*.rs→ Rust Leptos WebApp (canvas UI, TLS server)engine/include/saphyre/*.hpp→ C++ headers (interfaces, templates)python/enrichment_pipeline/*.py→ ML agents (FAISS, embeddings)engine/schemas/*.json→ JSON schemas (validation, contracts)ops/scripts/*.sh→ Bash automation (Arch Linux, Wayland-safe)ops/systemd/*.service→ systemd units (user services).github/workflows/*.yml→ CI/CD pipelinescmake/*.cmake→ Build configurations
Language-Specific Application Rules
C++ Files (engine/)
When modifying C++ code:
- CHECK CMakeLists.txt for target linkage
- ENSURE header guards use
#pragma once - VERIFY coroutine usage with C++20 features
- VALIDATE CUDA code paths with RTX 3050 Ti compatibility
- ENFORCE constexpr where applicable for compile-time optimization
TypeScript Files (extension/)
When modifying TypeScript:
- VERIFY N-API bridge compatibility
- CHECK package.json for dependency versions
- ENSURE VS Code API version matches engines requirement
- VALIDATE command contributions in package.json
- TEST with pnpm, not npm or yarn
Rust Files (webapp/)
When modifying Rust:
- CHECK Cargo.toml for feature flags
- VERIFY Leptos SSR/CSR split
- ENSURE TLS certificate paths are configurable
- VALIDATE WASM target compatibility if client-side
Python Files (enrichment_pipeline/)
When modifying Python:
- CHECK requirements.txt for version pins
- VERIFY ONNX Runtime CUDA EP compatibility
- ENSURE Kafka consumer group configurations
- VALIDATE FAISS index dimensions match embeddings
Critical Path Dependencies
Map these interconnected components:
controller.cpp← →elements_model.cpp← →Main.qmlgit_repo.cpp→libgit2→git_hooks.cppretrieval_faiss.cpp→ FAISS GPU →embeddings_onnx.cpporchestrator.proto→ gRPC →extension.ts
Wayland-Specific Constraints
For any clipboard or display operations:
- REPLACE
xclip/xselwithwl-copy/wl-paste - SUBSTITUTE
xrandrwithwlr-randr - USE QT_QPA_PLATFORM=wayland environment
- AVOID X11 dependencies entirely
File Creation Protocol
When creating new files:
- ASK user for exact directory path
- CREATE parent directories if needed
- APPLY appropriate file permissions (executable for scripts)
- ADD to relevant CMakeLists.txt or Cargo.toml if applicable
- UPDATE module exports/imports in index files
Modification Safety Checks
Before applying changes:
- BACKUP original file to
.bakif requested - VALIDATE syntax using language-specific linters
- CHECK for breaking changes in public APIs
- VERIFY no secret leakage in commits
- ENSURE reproducible build flags maintained
Integration Points
Connect these systems when modifying:
- VS Code Extension ↔ C++ Engine: via UDS at
$XDG_RUNTIME_DIR/saphyre-engine.sock - WebApp ↔ Engine: via gRPC over UDS or localhost:7420 TLS
- Git Hooks ↔ Engine: via socat to UDS
- Systemd Services ↔ Engine/WebApp: via service dependencies
Error Recovery
If path ambiguity detected:
- LIST all possible matching paths
- SHOW file tree context around matches
- REQUEST explicit selection from user
- CONFIRM selection before proceeding
Performance Critical Paths
Optimize these locations with extra care:
retrieval_faiss.cpp: GPU memory alignmentembeddings_onnx.cpp: Batch processinghit_test.cpp: QML scene graph traversalorchestrator.cpp: Chain topology sorting
Build System Updates
When files affect build:
- UPDATE CMakeCache.txt via reconfigure
- REGENERATE compile_commands.json
- VERIFY ninja build targets
- CHECK DKMS compatibility for kernel modules