{"slug": "kshetrajna-drift-i-let-a-local-llama-deal-with-my-download-pile", "title": "Kshetrajna Drift: I Let a Local Llama Deal With My Download Pile", "summary": "A developer built Kshetrajna Drift, a local file-organizing companion that uses Llama 3.1 8B through an installed Ollama service to suggest purpose-based destinations (Study, Work, Receipts, Personal, Read Later, or Keep here) for loose files in one approved folder, with a short explanation for each suggestion that the user reviews and approves before any move. The model must return structured JSON with a known file ID, an allowed category and a reason, and the app independently validates the response, rejecting missing IDs, duplicates, invented categories, unexpected fields and invalid explanations; if the model is unavailable, nothing moves. Before execution the app rechecks hashes, file identity, sizes and modification times, journals each move intent to SQLite before creating destinations without overwriting, and supports undo and restart recovery, though batches are not atomic and same-volume hard-link support is required.", "body_md": "*This is a submission for the [Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady](https://dev.to/challenges/hacktoberfest-week3-2026-10-19).*\n\nI don't usually put off filing a document because dragging it is difficult. I put it off because I have to decide what it is, where it belongs, and whether I will find it again.\n\n**Kshetrajna Drift** takes that first decision off my plate. It is a small local companion that reads one approved folder, asks an open-weight model to suggest homes for loose files, and shows an explanation for each suggestion. I select the moves I agree with and approve them together.\n\nA receipt, a client brief, and a picnic note might all be `.txt` files. They should not necessarily live together. Drift groups by purpose: Study, Work, Receipts, Personal, Read Later, or Keep here.\n\nThe final category matters. Sometimes the laziest sensible action is to leave something alone.\n\n[Watch the recorded walkthrough](https://github.com/ParramNainani/kshetrajna-drift/blob/codex/initial-build/evidence/walkthrough.gif): seven actual browser UI snapshots, with waiting condensed. The files are synthetic, but the inference, approved move and undo are real.\n\nThe walkthrough shows a client handover brief going to Work, revision notes to Study, a payment receipt to Receipts, a bird article to Read Later, and a picnic note to Personal. An ambiguous note containing “blue / maybe next time / 42” stays where it is. I then move the receipt and undo it.\n\nRun the same demo with `python app.py --demo`. It creates a disposable copy of the six bundled samples and leaves personal Downloads alone.\n\nThe new standalone repository contains the Python application, dependency-free browser interface, six fixtures, tests, setup guide, license and measured evidence. The code is MIT licensed. [Download the source ZIP](https://github.com/ParramNainani/kshetrajna-drift/archive/refs/heads/codex/initial-build.zip) and follow the README to run locally.\n\n**Credit:** Drift is inspired by our existing [Kshetrajna project](https://github.com/Team-SankatMochan/KSHETRAJNA-OS), especially its Observe → Explain → Approve → Act → Recover approach. This is a new application created on October 25, not the older application presented as fresh work. No source files were copied from that repository.\n\nThe reasoning engine is **Llama 3.1 8B**, running through an installed **Ollama** service on the same computer. The model receives file IDs, filenames, sizes, and optionally short previews of supported text files. The real-folder default sends filenames and sizes only. The sample demo enables previews so the purpose of vague filenames is visible.\n\nThe model must return structured JSON: a known file ID, an allowed category, and a short reason. Drift independently validates the answer. Missing IDs, duplicates, invented categories, unexpected fields and invalid explanations stop the plan. If the model is unavailable, the app reports an error and moves nothing. There is no hidden filename-rule classifier substituting for AI.\n\nThe rest uses Python's standard library, SQLite and plain HTML/CSS/JavaScript. The local server binds to loopback. The model cannot issue shell commands or choose arbitrary filesystem paths.\n\n``` php\nflowchart LR\n    A[Approved folder] --> B[Bounded local scan]\n    B --> C[Ollama and Llama 3.1 8B]\n    C --> D[Validate IDs and categories]\n    D --> E[Explained plan]\n    E --> F[Select and approve]\n    F --> G[Recheck files and destinations]\n    G --> H[Journal then move]\n    H --> I[Undo and restart recovery]\n```\n\nBefore execution, Drift rechecks hashes, file identity, sizes and modification times. Existing destinations block the selection. Each file's move intent is committed to SQLite before its destination is created without overwriting another file. The source name is then removed. This requires same-volume hard-link support; unsupported filesystems fail without a copy/delete fallback.\n\nThe batch is not atomic: if a later move fails, earlier successful moves remain visible and undoable. Undo refuses changed files or occupied original names. Interrupted operations are reconciled on restart, with unresolved conflicts kept visible.\n\n**31 automated tests passed on Windows**, including real file moves and undo, changed-file rejection, name conflicts, interrupted-operation recovery, malformed model output, model failure and local HTTP access checks. The model run is recorded separately from tests that use explicit doubles.\n\nFor this workflow, the inputs can be the private things sitting on a person's computer. Running the model locally means a hosted provider does not have to receive the filenames or snippets to make a filing suggestion.\n\nIt also lets me change the prompt, category policy, validation and execution behavior together. The model proposes; code I control sets the limits. Another installed local model can be selected without replacing the whole application.\n\nAfter the runtime and weights are installed, the workflow can operate without an internet connection. I verified local loopback inference; I have not yet measured a disconnected-network run. There is no hosted per-request model charge, though the computer, storage and electricity still cost money.\n\nOllama is open-source software. Llama 3.1 is **open-weight under Meta's Community License**, which is different from calling its weights OSI open source. The model is not bundled in the source package.\n\nThe [first six-file plan](https://github.com/ParramNainani/kshetrajna-drift/blob/codex/initial-build/evidence/local-inference.json) took **17.56 seconds**. All five filing choices and the Keep-here decision matched the intended sample purposes. A second recorded walkthrough run took **15.24 seconds**. After moving and undoing the receipt, [all six originals matched their fixture SHA-256 hashes](https://github.com/ParramNainani/kshetrajna-drift/blob/codex/initial-build/evidence/ui-roundtrip.json).\n\nThis is a small synthetic demonstration, not a measured claim about hours saved or general classification accuracy. It shows the interaction I wanted: let the machine read the small pile, review one clear plan, and go back to something more interesting.\n\nThe deliberate limit is twelve loose files per batch. This prototype has no background watcher, PDF extraction, OCR, automatic deletion, or unattended sorting. Slow and steady seemed like a good reason to make the scope small enough to understand.\n\n*Built with AI coding assistance. Design references: [Ollama structured outputs](https://docs.ollama.com/capabilities/structured-outputs), [Llama 3.1 license](https://github.com/meta-llama/llama-models/blob/main/models/llama3_1/LICENSE). Community reading included [Jangwook Kim's structured-output walkthrough](https://dev.to/jangwook_kim_e31e7291ad98/ollama-structured-outputs-in-practice-getting-type-safe-json-from-local-llms-with-pydantic-m38) and [Neeraj Singhi's tool-boundary validation discussion](https://dev.to/neeraj_singhi_golang/prompt-injection-at-the-tool-boundary-sanitizing-llm-driven-function-calls-in-go-microservices-4emb). Comment retrieval was unavailable; these are individual references, not a claimed community consensus.*", "url": "https://wpnews.pro/news/kshetrajna-drift-i-let-a-local-llama-deal-with-my-download-pile", "canonical_source": "https://dev.to/parramnainani/kshetrajna-drift-i-let-a-local-llama-deal-with-my-download-pile-4kco", "published_at": "2026-10-25 18:32:59+00:00", "updated_at": "2026-10-25 18:43:00.620320+00:00", "lang": "en", "topics": ["ai-tools", "large-language-models", "ai-agents", "developer-tools"], "entities": ["Kshetrajna Drift", "Llama 3.1 8B", "Ollama", "Kshetrajna", "GitHub", "SQLite"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/kshetrajna-drift-i-let-a-local-llama-deal-with-my-download-pile", "markdown": "https://wpnews.pro/news/kshetrajna-drift-i-let-a-local-llama-deal-with-my-download-pile.md", "text": "https://wpnews.pro/news/kshetrajna-drift-i-let-a-local-llama-deal-with-my-download-pile.txt", "jsonld": "https://wpnews.pro/news/kshetrajna-drift-i-let-a-local-llama-deal-with-my-download-pile.jsonld"}}