Thank you for your interest in contributing to DiskTracker — a high-performance, real-time Windows file-system change tracking utility written in Rust.
- Code of Conduct
- Project Overview
- Getting Started
- Workspace Structure
- Development Workflow
- Running Tests
- Architecture Primer
- Submitting a Pull Request
- Reporting Issues
- License
Be respectful, constructive, and welcoming. Harassment or discrimination of any kind will not be tolerated. When in doubt, be kind.
DiskTracker tracks every file-system change on a Windows volume in real time using the NTFS USN Journal. It uses a Log-Structured State Machine model to decouple:
- A fast append-only write path (raw USN events →
mutation_logSQLite table) - A slow state-reduction path (Drain Engine →
factstable)
This design avoids database contention and allows zero-overhead event capture even under heavy I/O.
The project targets Windows (x86_64 and ARM64) as its primary platform. Linux/WSL builds compile but use mock implementations for platform-specific code (useful for CI and development).
| Tool | Version | Notes |
|---|---|---|
| Rust | stable (latest) | Install via rustup |
x86_64-pc-windows-gnu target |
— | For cross-compiling on Linux |
x86_64-pc-windows-msvc target |
— | Required for x64 release builds |
aarch64-pc-windows-msvc target |
— | Required for ARM64 release builds |
| Git | any | — |
On Linux/WSL (development only):
rustup target add x86_64-pc-windows-gnu
sudo apt-get install gcc-mingw-w64On Windows (native / CI):
rustup target add x86_64-pc-windows-msvc
rustup target add aarch64-pc-windows-msvcgit clone https://github.com/pratham15541/disktracker.git
cd disktracker
# Native Linux/WSL build (mock platform layer — compiles only, no Windows APIs)
cargo build
# Cross-compile for Windows from Linux
cargo build --target x86_64-pc-windows-gnu
# Release builds on Windows (used in CI)
cargo build --release -p disktracker --bin disktracker --target x86_64-pc-windows-msvc
cargo build --release -p disktracker --bin disktracker --target aarch64-pc-windows-msvcNote: Always verify the build compiles before starting development. If
PROGRESS.mdclaims a feature is complete, cross-check it against the actual crate source — never trust docs blindly.
This is a Cargo workspace. Each crate has a single, well-defined responsibility:
disktracker/
├── apps/
│ └── cli/ # CLI frontend: init, status, doctor, uninstall + daemon launcher
└── crates/
├── core/ # Shared types: Fact, Mutation, RawEvent, progress registry
├── storage/ # SQLite connection pool, WAL PRAGMAs, table schemas
├── scanner/ # Directory walker (Win32 batch API on Windows, mock on Linux)
├── pipeline/ # Coordination pipeline between scanner, watcher, and drain
├── api/ # Named pipe IPC server, JSON-RPC handler, Drain Engine
├── agent/ # AI agent integration layer
├── telemetry/ # Progress tracking and telemetry emission
├── config/ # Configuration loading and management
├── common/ # Shared utilities across crates
├── platform/
│ ├── traits/ # Platform abstraction interfaces (IpcListener, etc.)
│ └── windows/ # Win32 bindings: USN journal, OpenFileById, elevation checks
└── rust-langgraph/ # Vendored LangGraph runtime (patched via [patch.crates-io])
- No circular crate dependencies.
coreandcommonare leaf crates — they must never depend on other workspace crates. - Platform code is isolated. Only
crates/platform/windowsshould contain#[cfg(target_os = "windows")]Win32 API calls. All other crates use thetraitsabstraction. apps/cliis the only binary. All library logic belongs incrates/.
Work is organized into numbered loops (see docs/AI_MASTER_PLAN.md). Each loop targets a self-contained feature or subsystem. Follow this pattern:
# Create a branch for your work
git checkout -b loop-N-short-description
# Work, test, iterate...
# Merge only after Windows manual verification
git checkout main
git merge loop-N-short-description
git tag loop-N-verified
git push --tagsNever commit directly to
main. PRs must be merged only after manual Windows testing has been confirmed.
If an agent or automated change makes a mess, roll back cleanly:
git reset --hard loop-N-verified- Read the architecture first. Read
docs/ARCHITECTURE.mdand the relevant crate'sCargo.toml/ source before writing code. - Keep crate boundaries clean. If your change introduces a new dependency between crates, justify it.
- Platform stubs. If adding a new Win32 call, add a stub/mock implementation behind a
#[cfg(not(target_os = "windows"))]guard so Linux builds continue to compile. - No agent commits to main. AI-assisted code must be reviewed and manually tested on native Windows before merging.
Use conventional commit prefixes:
feat: add USN journal replay on startup
fix: drain engine skipping deleted directory entries
refactor: extract OpenFileById into platform-windows crate
docs: update ARCHITECTURE.md with drain state table schema
chore: bump rust-langgraph patch version
Keep commits atomic — one logical change per commit.
# Run all tests (Linux-compatible; platform tests are stubbed)
cargo test
# Run tests for a specific crate
cargo test -p disktracker-core
# Run with output visible
cargo test -- --nocaptureWindows-specific integration tests (USN journal, Named Pipe IPC) must be run on a native Windows machine or Windows CI runner. They will be skipped automatically on Linux.
DiskTracker's three core components per volume:
| Component | Role | Write Target |
|---|---|---|
| Watcher | Streams NTFS USN journal events in real time | mutation_log (append-only) |
| Scanner | Crawls the volume at startup for a baseline | facts (bulk insert) |
| Drain Engine | Polls mutation_log, resolves file sizes, merges into facts |
facts (UPSERT/DELETE) |
Lifecycle gating: The Drain Engine is blocked in BaselineScanning state until the Scanner completes, then replays the overlap window in Reconciling state, and finally enters Live (polling every 500ms).
SQLite is configured with WAL mode for lock-free concurrent reads and writes.
See docs/ARCHITECTURE.md for the full design with diagrams and schema definitions.
- Fork the repository and create your branch from
main. - Build and test your changes locally:
cargo build cargo test - Cross-compile to verify Windows compatibility:
cargo build --target x86_64-pc-windows-gnu
- Open a PR against
mainwith a clear description of:- What problem this solves or what feature it adds
- Which loop or area of the architecture it touches
- Whether Windows manual testing was performed (and the result)
- Link any related issues in the PR description.
PRs that break the Linux cross-compilation build or introduce circular crate dependencies will be rejected.
Use GitHub Issues to report bugs or request features.
When reporting a bug, please include:
- OS and version (Windows edition, build number)
- DiskTracker version or commit SHA
- Steps to reproduce
- Expected vs actual behavior
- Relevant logs (run with
RUST_LOG=debug disktrackerand attach the output)
By contributing, you agree that your contributions will be licensed under the MIT License.
Maintainer: Pratham Parikh