@richardgill/pi-file-collector

Pi extension for collecting file/line evidence seen or cited during a session.

Packages

Package details

extension

Install @richardgill/pi-file-collector from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@richardgill/pi-file-collector
Package
@richardgill/pi-file-collector
Version
0.0.10
Published
May 24, 2026
Downloads
416/mo · 34/wk
Author
richardgill
License
unknown
Types
extension
Size
37.7 KB
Dependencies
2 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./src/index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-file-collector

Pi extension for collecting file/line evidence seen or cited during a session.

Part of pi-extensions.

Install with pi

pi install npm:@richardgill/pi-file-collector

Configure

You can override individual settings in file-collector.jsonc.

The default location is ~/.pi/agent/file-collector.jsonc, or $PI_EXTENSION_CONFIG_DIR/file-collector.jsonc when set.

{
  "filenameSuffix": "file-line-events.jsonl",

  "collectReadTool": true,
  "collectWriteTool": true,
  "collectEditTool": true,
  "collectBashCommand": true,
  "collectBashOutput": true,
  "collectAssistantOutput": true,

  "appendSystemPrompt": "When citing files, always include file paths with line ranges like ./src/file.ts:12-18. Prefer this format over prose-only references. When using rg or grep always use -n",

  "bashShimCommands": [
    { "name": "cat", "capture": { "paths": { "from": "positionals" } } },
    {
      "name": "sed",
      "capture": {
        "paths": { "from": "positionalsAfter", "arg": "script" },
        "matchedText": { "from": "arg", "arg": "script" },
        "range": { "from": "sedPrintScript", "arg": "script" }
      }
    },
    {
      "name": "grep",
      "argv": { "valueOptions": ["-f"], "namedValueOptions": { "-e": "pattern" } },
      "capture": {
        "paths": { "from": "positionalsAfter", "arg": "pattern" },
        "matchedText": { "from": "arg", "arg": "pattern" }
      }
    },
    {
      "name": "head",
      "argv": { "valueOptions": ["-n", "--lines"] },
      "capture": {
        "paths": { "from": "lastPositional" },
        "range": { "from": "headLineCount", "option": "-n" }
      }
    },
    {
      "name": "tail",
      "argv": { "valueOptions": ["-n", "--lines"] },
      "capture": {
        "paths": { "from": "lastPositional" },
        "range": { "from": "tailLineCount", "option": "-n" }
      }
    }
  ],

  "assistantCitationPatterns": [
    {
      "regex": "(?:^|[\\s`\\\"'(<\\[])(?<path>[^\\s`\\\"'<>)]*?)#L(?<start>\\d+)(?:-L?(?<end>\\d+))?",
      "flags": "g"
    },
    {
      "regex": "(?:^|[\\s`\\\"'(<\\[])(?<path>[^\\s`\\\"'<>)]*?):(?<start>\\d+)(?:-(?<end>\\d+))?",
      "flags": "g"
    }
  ],

  "bashOutputPatterns": [
    { "regex": "^(?<path>.+?):(?<start>\\d+):(?<matchedText>.*)$", "flags": "gm" }
  ]
}

Usage

  • Records read-tool ranges, write/edit-tool ranges, declarative bash shim file arguments, grep-style bash output, and assistant file citations.
  • Optionally appends appendSystemPrompt to the system prompt each user turn.
  • Writes a JSONL per session beside the session file: <session-basename>-file-line-events.jsonl.