Codumentor logo Codumentor Enterprise

Client Filesystem Plugin

Lets users attach a local folder (or drop individual files) from the browser so the agent can read and copy those files during the conversation. The folder stays on the user's machine; the server only sees contents when the agent or an @-mention actually reads a file.

Folder attach uses the browser File System Access API. It needs a Chromium browser (Chrome or Edge) and a secure context (HTTPS or localhost). Firefox and Safari are not supported. A browser tab with the conversation's folder must be open while files move; see When the tab is away.

Configuration

plugins:
  - module: codumentor.plugins.client_fs
    class: ClientFsPlugin
    args:
      enabled: true
      auto_background_seconds: 60   # 0 = never auto-background
      max_copy_files: 500
      max_copy_bytes: 1073741824    # 1 GiB

Parameters

KeyTypeDefaultDescription
enabledbooltrueMaster switch.
auto_background_secondsint60A copy still running after this many seconds continues in the background and the tool returns. Skipped while the copy would finish within 30 s. 0 = never.
max_copy_filesint500A client_fs_copy_to_repo of more files is refused before a byte moves, with the counts, so the agent can copy a subdirectory instead.
max_copy_bytesint1073741824 (1 GiB)The same, for the total size.

Usage

Attach a folder

  1. Click + in the chat input and choose Attach Local Folder
  2. Grant permission when the browser prompts
  3. A folder chip in the composer shows the attached folder (📁 Project · 1,240 files); the agent gets four tools scoped to it

Click the chip for its popover: the file and directory counts, Refresh index and Detach… (which asks first).

After a reload, a long idle, or a revoked permission, the chip itself becomes the button: Resume access (one click, if the browser still has the handle), Reconnect (the page still holds the handle but the server lost it) or Re-attach (pick the folder again). Until then the agent is told the folder is disconnected and to ask you to re-attach it, rather than losing it without a word.

The server keeps attachments in memory. When it restarts, an open page that still has access re-attaches the folder by itself within a minute (on its next index refresh); a folder you detached stays detached.

Paths the agent uses are relative to the folder root (src/main.py, not my-folder/src/main.py). Use "." for the folder root.

ToolDescription
client_fs_list_dirList directory contents
client_fs_read_fileRead a file from the attached folder
client_fs_copy_from_repoCopy a repo file into the attached folder. run_in_background (optional) returns at once
client_fs_copy_to_repoCopy a file, or a whole directory (up to max_copy_files / max_copy_bytes), from the attached folder into the repo. run_in_background (optional) returns at once

These tools appear only while a folder is attached and accessible.

How files move

Every transfer is a job on the server that the open tab serves: it lists the files, then uploads (or, for client_fs_copy_from_repo, downloads) them in chunks of 128 KiB to 4 MiB, up to three files at a time, sizing both to the connection. Bytes land in a temporary file first and reach the repo or the folder only when complete. A lost chunk is retried, and a copy interrupted by a reload or a tab switch resumes where it stopped instead of starting over.

While a transfer runs, the chip shows it: progress, 12/80 · 34/120 MB · ~2 min as its detail line, the file being copied in the popover, and Cancel and Continue in background actions. The tab title gets a ⏳ 42% prefix. For the first seconds the detail line warns to keep the tab open, and closing or reloading the tab asks for confirmation while bytes are moving.

The tool result reports what arrived: files and bytes copied, the missing files by name (up to 20) with the reason, and how long it took, paused time included. A copy where only some files arrived says partly copied.

When the tab is away

The server notices when no tab serves the folder (the tab was closed, reloaded, or hidden long enough for the browser to throttle it). The chip turns amber (📁 Project · paused), a running copy pauses (⏸, "Paused — waiting for this tab"), and the agent is told the tab is not connected instead of waiting on it. When a tab comes back the copy continues by itself. A copy waiting for folder access again (after a revoked permission) says so and continues after Resume access.

A paused copy is kept for up to an hour without progress; then it fails and its temporary files are deleted.

Large copies continue in the background

A copy can stop holding up the agent's turn and go on in the background. Three things move it there:

The tool then returns at once, saying the files are not complete yet and naming an id such as cfs_3fa2c1. The agent can bg_wait(["cfs_3fa2c1"]) before it relies on the files, stop the copy with bg_kill, and see it in bg_list (cfs_3fa2c1 copying 12/80 docs → repo/docs ~2 min). The copy appears among the conversation's running background work, and when it ends a message with the same summary as a tool result arrives in the conversation (unless the agent already saw the end through bg_wait or bg_kill).

The chip keeps showing a backgrounded copy, since it is still your copy, with "continues in the background" on its detail line. It still needs the tab: a reload pauses it as it would any copy, so closing the tab still asks for confirmation. A paused background copy waits for you, bounded by the one-hour expiry, which also posts the message. Reads (client_fs_read_file) never go to the background.

Transfer jobs live in the server's memory. After a server restart the chip shows copy interrupted by a server restart (dismiss it from the chip) and the agent's bg_wait on the id answers at once that the copy is gone, so nothing is left waiting; copy the files again. No message tells the agent about a copy cut off by a restart; it finds out only when it waits on or stops the id, so tell it if it is relying on those files.

A finished copy's full report stays available for 10 minutes. After that, bg_wait or bg_kill on its id still answers in one line how it ended (for a day).

Access profiles

The folder holds the user's own files, and the server-side half of every copy
resolves through whatever the sandbox mounted for that turn. So this plugin
works for a user with every repository and for one with none — a
chat-only tier attaches a folder, the agent reads a document out of it, edits it
in the empty workspace and writes the result back. What it cannot express is a
partial scope (repos: [names]): client_fs_copy_from_repo names a path in
the working directory, and nothing downstream re-derives which repository that
path came from. For such a profile the tools are withheld and the plugin's HTTP
routes return 403. See Access Profiles.

The Document Editor can open a .docx from the attached folder and write it back on save.

@-mentions

Type @ plus part of a filename to search the attached folder. Choosing a result inlines that file's content into the message.

Attach a file or drag-and-drop

Attach File uploads one file. Drag files from the OS file manager onto the chat window to attach several at once. Oversized files are rejected with an alert, and so is an upload the server or a proxy refuses: the file gets no pill, so a message never goes out with a file the server does not have.

A file up to 256 KiB goes in one request. A larger one goes in raw chunks (PUT /single-file/chunk, 512 KiB, halved on a 413 down to 64 KiB), then POST /single-file/upload without content commits it. This keeps uploads under a reverse proxy's body limit (nginx defaults to 1 MiB).

Word, PDF and Excel uploads are converted to text for the agent. Any other file (a zip, say) is staged as-is for the agent to inspect with a shell tool. The original bytes are always staged so the agent can copy the file into a repo (for example "add the PDF I just uploaded").

Limit (upload and drag-and-drop): 50 MB per file.

See also