Skip to content

[Suggestion]: Add a global config file for pi-fff #789

Description

@XWIlluDelu

Which fff frontend?

@ff-labs/pi-fff

What problem are you trying to solve?

pi-fff has five public startup settings, but keeping any of them across launches currently means setting environment variables or wrapping every pi invocation with flags. This is especially awkward for override, which has to be known before the extension registers its tools.

Pi deliberately does not accept extension-owned keys in its core settings.json. Its maintainer recommends that extensions keep their own files under getAgentDir() instead: earendil-works/pi#1184

Proposed solution

Read <getAgentDir()>/pi-fff.json before registering tools. For example:

{
  "mode": "override",
  "frecencyDbPath": "/path/to/frecency",
  "historyDbPath": "/path/to/history",
  "enableFsRootScanning": false,
  "enableHomeDirScanning": true
}

This covers every currently documented startup option. Existing behavior stays ahead of the file:

CLI flag > environment variable > pi-fff.json > default/discovery

A missing file should be a no-op. Malformed JSON, unknown keys, and wrong value types should stop the extension from loading with a path-specific error rather than silently falling back. /fff-mode would keep its current session behavior and would not rewrite a global file implicitly.

I think the first version should be global only. mode is needed during tool registration, and the extension API does not expose trusted project configuration at that point. I would also leave out the hidden PI_FFF_MULTIGREP switch: it is not a documented setting, and the source already marks that tool for removal.

I have this implemented and covered in a fork, including loader validation, all five settings, and flag/env precedence. Happy to send the PR if this shape works for you.

Activity

  1. gustav-fff commented on Aug 16, 2026

    @gustav-fff
    Collaborator

    [triage-bot] FEATURE REQUEST: shape is correct, claims verified against main (459ebcd). Not implementing — see last line.

    All five settings are resolved once at extension-registration time, so a file loader has exactly one insertion point:

    • packages/pi-fff/src/index.ts:302-306 — mode (flag > env > "tools-and-ui")
    • packages/pi-fff/src/index.ts:311-317 — frecency/history db (flag > env > resolveDbPaths discovery)
    • packages/pi-fff/src/index.ts:320-340 — resolveBoolOpt for root/home scanning

    PI_FFF_MULTIGREP (packages/pi-fff/src/index.ts:1011) is correctly excluded — source comment above it says the tool is being removed.

    Two things for the PR:

    1. There is no getAgentDir() in the extension API surface this repo consumes — grep -rn getAgentDir returns nothing. pi-fff already resolves the dir itself at packages/pi-fff/src/paths.ts:55-57:
    function piDataDir(): string {
      return process.env.PI_CODING_AGENT_DIR ?? path.join(HOME_DIR, ".pi", "agent");
    }

    Reuse that (export it), do not add a new dependency on a pi API that is not there.

    1. This runs on every pi startup before any tool is registered. One readFileSync in a try/catch plus hand-written type checks. No schema library, no async, no extra statSync probe — ENOENT from the read is the missing-file no-op.

    @dmtrKovalenko — reporter has this in a fork and offered the PR. Needs your ack on the file name/location before they spend the effort; not opening a competing bot PR.
    Honk-Honk 🪿

  2. dmtrKovalenko commented on Aug 16, 2026

    @dmtrKovalenko
    Owner

    Yeah that makes sense. Feel free to open a PR just a favor I’d like to ask is yo have a single function to retrieve the configuration value that will look everywhere

  3. XWIlluDelu commented on Aug 16, 2026

    @XWIlluDelu
    ContributorAuthor

    Thanks. I updated the implementation to export and reuse the existing piDataDir(), removed the runtime getAgentDir() import, and put flag/env/file/fallback lookup behind one getConfigValue() function.

    The loader still does one synchronous read with hand-written validation. The pi-fff tests, typecheck, and focused Biome check pass.

    PR: #790

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions