simplefiles

Public

Lets a local model find, read and propose changes to files in folders you grant. Nothing changes until you approve it, every change is backed up, and the last one can be undone. It can also fill PDF forms in another language, and run your project’s own tests and builds.

60 Downloads

README

simpleFiles

simpleFiles lets a local model in LM Studio find your files, read the ones in folders you grant, and propose changes to them. Nothing is changed until you approve it, every change is backed up first, and the last change can always be undone.

It is built for models that make mistakes. The model can only propose; a change needs a message you typed. Edits replace an exact passage of a file instead of rewriting the whole file, so a model that loses track cannot silently drop the rest of it. After every write the file is read back and checked.

Setup

  • Install the plugin and turn it on in a chat.
  • Grant the folders it may work in: list them in the plugin's settings under Folders it may read and edit, or send /files grant <folder> in a chat. A whole drive or your whole home folder is not accepted; grant the project folders inside them.
  • Optionally, list folders it must never look in under Never look in.

The first time the plugin runs, it builds an index of file names in your home folder in the background. That takes a few minutes and continues across replies, so find_files may report that the index is still being built.

What the model can do

ToolWhat it does
find_filesFinds files and folders anywhere in the indexed folders by name. Returns paths only and reads nothing. Paths outside the granted folders are marked (not granted), and the model is told to ask you to grant the folder.
list_folderLists a folder inside the granted folders.
read_fileReads a text file inside the granted folders, 300 numbered lines at a time, or fewer, or the end of the file, or only the lines containing some text.
search_in_filesSearches the text of the files in a granted folder and returns the matching lines.
propose_editProposes replacing one exact passage of a file. The passage must appear exactly once, or the proposal is refused.
propose_new_fileProposes a new file. It cannot replace an existing one, and it turns away a file that copies one the model read (exactly or nearly), pointing to copy_files instead.
copy_filesProposes copying files or folders to another place in the granted folders, byte for byte, without passing their contents through the model. For archiving, duplicating or backing up.
read_formReads a fillable PDF form as its printed text with each field marked and numbered where it sits, for example Name [#1 text] Surname [#2 text] or Married [#8 ○] yes [#9 ○] no.
fill_formProposes a filled copy of a PDF form from field numbers and answers. See below.
list_proposalsLists the changes waiting for your approval and the ones applied recently, so the model checks instead of remembering.

The model cannot delete, move or rename files, and cannot run programs of its choosing.

Filling in forms in another language

read_form and fill_form let the model work through a fillable PDF form with you in your own language: it reads the form, tells you in a few lines what it asks, and asks for all the answers in one message (a long form a section at a time, or one question at a time if you say so). Answers it already knows from the chat or from memory come as drafts for you to confirm. It then fills your answers in the form's language.

  • The original is never changed. The first fill writes a copy beside it with -filled in its name (or where save_as says); later fills add to that copy, keeping earlier answers. Every fill is a proposal you apply with /files apply, and /files undo takes it back.
  • The proposal lists each answer as it will be written, with its meaning in your language, so you can check the translation before anything is written. A corrected proposal for the same form replaces the earlier one it covers.
  • Text is written with a font that has the letters these forms need (ą, č, ő, ø, ş and so on): Arial on Windows. The forms' own fonts usually lack them. An answer is sized down to fit its box, and one that still cannot fit is refused with how much room there is, rather than cut off.
  • Checkboxes and choices keep the form's own look. Signature fields are never filled; you sign them.
  • A machine translation can be wrong, and on forms like insurance applications a wrong answer matters. Check the translated answers, or have them checked, before you submit.
  • Only forms with fillable fields work. A scanned or flat PDF has no fields to fill.

You can also attach a document to the chat. LM Studio keeps attachments in its own folder, which simpleFiles never opens, so each attached document is copied into an attachments folder (Documents\simpleFiles attachments unless you set another in the plugin's settings, or off), and the model is told where the copy is. That folder is granted once something is in it. An attached PDF with fillable fields is also taken off the message, so LM Studio's document reader does not paste its text into the chat as well; the model reads it with read_form. If the document reader runs first (it comes before simpleFiles in the chat's plugin list), simpleFiles finds the attached file in LM Studio's folder by the name the reader wrote, and takes a form's pasted text back out. Attaching the same file twice keeps one copy; images are left with the message.

Running a project's own commands

When a granted folder holds a project, the model also gets run_script, which runs the commands the project declares for itself:

  • the scripts in a package.json (test, build, lint and so on);
  • pytest, for a Python project that uses it;
  • the targets in a Makefile, when make is installed;
  • for an LM Studio plugin, lmstudio-install (install its current code into LM Studio) and lmstudio-log (what the plugin wrote to LM Studio's log today: its messages and errors, and when it started and stopped, nothing from other plugins).

The model picks a command by name and never writes one. Without a name, run_script lists them, with what each runs. How each one runs:

  • Checks (tests, lint, type checks) run straight away in folders you trust. The first time the model wants one somewhere else, it asks; /files trust <folder> lets checks in that folder and everything inside it run from then on. Trust your own projects; leave downloaded ones untrusted, since their test scripts can do anything.
  • Everything else (a build, a deploy, an install) is a proposal showing the exact command, and runs only when you send /files apply, every time. A command cannot be undone, except an LM Studio install.
  • An LM Studio install also needs a passing run of the plugin's tests on exactly the code being installed. It updates a plugin LM Studio already has (install it once from the hub or with lms dev --install first), builds it the way LM Studio's installer does, replaces the installed src folder as a whole, and keeps the previous version, so /files undo puts it back. LM Studio uses the new version the next time it starts the plugin; to be sure, turn the plugin off and on again, or restart LM Studio.

A long check keeps running in the background, and the model collects the result with its next call. In chats where no granted folder holds a project, run_script is not offered at all. Turn Project commands off in the settings to never offer it.

Your commands

Send these as chat messages in a chat with the plugin on. The plugin answers them itself; the model only shows the result.

/files status            granted folders, waiting changes, recent changes, the name index
/files pending           show each waiting change with the lines it removes and adds
/files apply 3           make change #3 (with one change waiting, /files apply is enough)
/files apply all         make every waiting change, in the order they were proposed
/files reject 3          drop change #3 (or /files reject all)
/files keep 3            leave change #3 waiting
/files undo              reverse the last change that was made
/files grant <folder>    let the model read that folder and propose changes in it
/files revoke <folder>   take a chat grant back
/files reindex           rebuild the file name index now
/files trust <folder>    let checks (tests, lint, type checks) in projects there run without asking
/files untrust <folder>  make them ask first again
/files autoapply <folder> [time]   let changes there take effect without asking, for 2 hours or the time given (such as 4h)
/files autoapply          turn it on for the folder the waiting changes are in, or show what is on
/files autoapply off     end it

A command can also come after other words, as in done, /files apply 3, and one message can hold several, as in /files apply 4 5 /files reject 6; each command takes only its own numbers, and the rest of the message goes to the model as usual, so in /files apply 3 and then run the tests the model is asked to run the tests. A message that both applies and rejects the same change does neither. Anything without /files goes to the model, which cannot apply changes. Within a command, numbers can be written as 4, #4 or 4 and 5, and extra words are fine (/files apply all please). An exception such as all except 4 is refused rather than guessed at; name the numbers instead.

A change is applied only if its passage is still in the file exactly once, so a proposal made before you edited the file yourself is refused rather than applied in the wrong place. Undo restores the backup only if the file is still exactly as simpleFiles left it; if you changed it since, undo tells you where the backup is instead of overwriting your work.

Letting a task run without approving each change

A task that changes many files otherwise stops after every batch to ask, and the approvals pile up. /files autoapply <folder> lets the model's edits, new files, copies and the project's own build (a script named build, compile or bundle) take effect in that folder without /files apply, for two hours or the time you add, up to 60 changes. Each change is still backed up and logged, /files status lists them, and /files undo reverses the last one. Plugin installs and every other command still ask. It ends by itself when the time or the changes run out, or when you send /files autoapply off. Use it on a project that is in git or otherwise backed up, for a task you have agreed on.

Handing work to a fresh chat

A long session's view of its own work drifts as the chat is compacted: it starts to misremember what was applied, what it ruled out, and what broke. When that happens, it is better to hand the work to a new chat than to push on.

With a project granted, the model gets write_handoff: it records the goal, what was tried and ruled out, and the next step. The handoff belongs to a folder: a project, or a repository root holding several projects. simpleFiles adds the verified state itself (waiting and applied changes, the last test result of each project and whether its code changed since, the recent change log, and a plugin's log) and recomputes it every time the handoff is read, so the facts never go stale in the saved file. The handoff lives in simpleFiles' data folder, never in the project, so it cannot end up in a commit or an upload.

Your commands:

/files handoff [folder]   show the handoff and the current state; without a folder, for the folder of the latest changes
/files resume [folder]    in a new chat, load the handoff and the current state; without a folder, the newest handoff

In the new chat, /files resume prints the previous session's judgment with the state gathered fresh, and the model is told to confirm it with its own tools before changing anything. Naming a folder inside the one the handoff belongs to finds it too. If the context compressor is on, it suggests a handoff on its own once a chat has been compacted several times.

After simpleFiles is updated, the next message in a chat with granted folders tells the model, once, what its tools can now do, since a model in the middle of a long chat otherwise carries on with the tools it remembers.

What is protected

  • Folders: every path is resolved, following links and junctions, and must lie inside a granted folder. A path that leads outside, through .. or a link, is refused.
  • Secrets: files that usually hold keys or passwords (.env files, SSH and other private keys, certificates, password databases, credential files) are never read or changed, even in a granted folder.
  • Tool folders: the insides of .git and node_modules can be read but never changed.
  • LM Studio's own folder (.lmstudio in your home folder) is never granted: it holds your chats, your memory file and saved credentials. Plugin installs and plugin logs have their own tools.
  • The name index never enters hidden folders (names starting with a dot), app data, system folders, node_modules, or the folders under Never look in. It holds names only, never contents.

What is stored

Everything is kept in .lmstudio\simplefiles in your home folder:

  • backups\: the original of every file before each change, by project and time, with a note of the change
  • changes.md: a readable log of every change and undo
  • pending.json, applied.json, grants.json: waiting changes, made changes, and folders granted from chats
  • names\: the file name index
  • installs\: the last few versions of each plugin installed through lmstudio-install, for undo
  • tests\: the result of each project's last test run
  • trusted.json: the folders trusted for checks

The name index lists the names of the files in your home folder, so it stays on your computer like the rest. Delete the names folder to remove it; it is rebuilt when needed.

Keeping personal details off the internet

A model that has read a file can repeat it elsewhere, for example in a web search if a search plugin is on in the same chat. simpleFiles records fingerprints (short hashes, not the text) of the email addresses, phone and account numbers, and keys and IDs in what it shows the model, in .lmstudio\local-only in your home folder, and marks its output with a privacy: local line. simpleSearch uses them to block any search containing those details, and can also be set to ask before every search in a chat with your files in it. A search plugin that does not check for this can still send what the model read, so grant only folders whose contents you are comfortable having the model see.

License

PolyForm Noncommercial 1.0.0: free for personal and other noncommercial use. Selling it, or using it in a paid product or service, needs permission from attitudejacket. See LICENSE.txt.