Skip to content

AI features

Galactus edited this page Oct 21, 2026 · 1 revision

AI features

Fūin is designed as a bridge between you and AI tools: the place where you pick context for a chat, and the thing agents can ask "what is the user looking at?". Nothing here calls an LLM or sends data anywhere by itself. Design notes: docs/DESIGN.md.

Context packs

Context for AI bundles the selection (or the current folder) into a single Markdown or XML document — a file tree followed by the file contents — and copies it to the clipboard, ready to paste into a chat.

  • Ctrl+Shift+I: copy context for the selection (or the current folder).

  • AI panel (Ctrl+I): Copiar contexto, a format choice, the token estimate and the list of skipped files; the CLI button copies the equivalent command.

  • Command line:

    fuin --context [--format markdown|xml] paths… | wl-copy

    The document goes to stdout; a summary (tokens, files, summarized, skipped, secrets blocked) goes to stderr.

  • MCP: the fuin_context_pack tool.

Rules (from src/ai/ContextPacker.cpp and DESIGN.md):

  • Folders inside a git work tree use git ls-files -co --exclude-standard (respects .gitignore); otherwise a walker skips node_modules, .venv, target, build, dist, __pycache__, .git…
  • Skipped: secret-looking files, lockfiles (package-lock.json, yarn.lock, uv.lock, Cargo.lock…), binaries, files over 256 KB, and anything beyond 400 files / 2 MB.
  • Parquet, safetensors, GGUF, ONNX and tables larger than 32 KB are included as a schema summary (columns, types, nulls, min/max, first rows / model header and tensors) instead of raw data.
  • Token estimate: characters / 3.6. The AI panel warns above ~150 K tokens.

MCP server

fuin --mcp runs a Model Context Protocol server on stdio. It is a separate headless process started by your MCP client. Read-only tools work even when the Fūin window is closed; fuin_get_current_view and the write tools talk to the running GUI over $XDG_RUNTIME_DIR/fuin.sock (fuin_reveal starts the GUI if needed).

Supported protocol versions: 2024-11-05, 2025-03-26, 2025-06-18 and 2025-11-25 (initialize), plus the stateless server/discover draft.

Register it in a client

Claude Code:

claude mcp add --scope user fuin -- fuin --mcp

Cursor (~/.cursor/mcp.json) and other clients that use the common mcpServers format:

{ "mcpServers": { "fuin": { "command": "fuin", "args": ["--mcp"] } } }

Tools

Descriptions are taken from src/ai/McpServer.cpp.

Tool Kind Description
fuin_get_current_view read Returns what the user is looking at in Fūin right now: the active folder, selected files, open tabs and the previewed file. Use it to resolve "this folder" or "these files".
fuin_list_directory read Lists a directory (name, type, size, modified time, git branch for repos). Paths may use ~. Arguments: path, show_hidden (default false), limit (default 500).
fuin_read_file read Reads a UTF-8 text file. Refuses binaries and files that look like secrets (.env, keys, tokens). Arguments: path, offset, max_bytes (default 65536, max 1048576).
fuin_search read Finds files by name (fd) or, with content=true, by text inside files (ripgrep). Respects .gitignore. Arguments: query, path (default: current view or ~), content, limit (default 100).
fuin_inspect read Structured metadata for a file: schema, row count, null counts and min/max for CSV/TSV/JSON/JSONL/Parquet; tensors, parameter count, dtype and quantization for .safetensors/.gguf/.onnx; dimensions for images; project type and README for folders. Arguments: path, sample_rows (default 10).
fuin_context_pack read Bundles files/folders into one Markdown or XML document (tree + contents). Respects .gitignore and skips binaries, lockfiles and secrets. Returns the document and a token estimate. Arguments: paths, format (markdown | xml).
fuin_reveal read Opens Fūin at a file or folder and selects it so the user can see it (starts Fūin if needed). Arguments: path, preview.
fuin_create_folder write Creates a folder. Requires Permitir escritura a agentes in Fūin; the user must approve it in the UI. Undoable.
fuin_copy write Copies files into a folder. Requires write permission and user approval in the UI. Undoable. Arguments: sources, destination.
fuin_move write (destructive) Moves files into a folder. Requires write permission and user approval in the UI. Undoable. Arguments: sources, destination.
fuin_move_to_trash write (destructive) Moves files to the trash (recoverable, undoable). Requires write permission and user approval in the UI. Arguments: paths.

Every tool carries readOnlyHint / destructiveHint annotations.

Security model

  • Paths are canonicalised and must be inside mcp/roots (default ~, see Configuration). Symlinks pointing out of the roots are refused.
  • fuin_read_file refuses binaries and anything the secret guard flags.
  • Write tools are rejected unless mcp/allowWrite=true — the Permitir escritura a agentes toggle in the AI panel (off by default).
  • When enabled, every write opens a dialog in the GUI showing the client name and the exact operation; no answer within 120 s means rejected. Writes are executed by the GUI through KIO, so they show progress and can be undone with Ctrl+Z.

Secret guard

src/ai/SecretGuard.cpp flags files by name and by content. Flagged files get a 🔑 badge, are never put into context packs and are never returned to agents.

  • Names: .env and .env.* (except .example, .sample, .template), SSH keys (id_rsa, id_ed25519…), *.pem, *.key, *.p12, *.pfx, *.jks, *.keystore, *.kdbx, *.gpg, *.asc, *.ovpn, credentials(.json), secret(s).json/yaml/toml, .netrc, .pgpass, .npmrc, .pypirc, .git-credentials, service-account*.json, *_token, token.json, auth.json.
  • Contents: private key blocks, AWS access keys, GitHub tokens, OpenAI/Anthropic-style API keys, Slack tokens, Google API keys, Hugging Face tokens, and database URLs with a password.

Found a secret that is not detected? Please report it privately — see SECURITY.md.

Not yet available

Ask your files (local semantic search with Ollama embeddings) is designed but disabled; it is in the Backlog (#9).

Clone this wiki locally