File Reader Skill

Enable your Moltbot agent to read local files.

File Reader

Allow your AI agent to read contents of local files on the system.

What It Does

  • Read text files (txt, md, json, yaml, etc.)
  • Read source code files
  • Read configuration files
  • Access logs and data files

Install / Enable

# .env
SKILL_FILE_READ_ENABLED=true
SKILL_FILE_READ_PATHS=/home/user/documents,/home/user/projects

Permissions Required

PermissionDescription
File SystemRead access to specified paths

Example Commands

User: Read the config.json file
Agent: [Reads /home/user/projects/config.json]
       Here's the content:
       {
         "version": "1.0.0",
         "debug": false
       }

User: What's in the README?
Agent: [Reads README.md]
       The README contains project documentation...

User: Show me the last 20 lines of the error log
Agent: [Reads /var/log/app/error.log, last 20 lines]
       Here are the recent errors...

Configuration

VariableDescriptionDefault
SKILL_FILE_READ_ENABLEDEnable the skillfalse
SKILL_FILE_READ_PATHSAllowed directories (comma-separated)none
SKILL_FILE_READ_MAX_SIZEMax file size in bytes1048576
SKILL_FILE_READ_EXTENSIONSAllowed file extensions*

Restricting Access

Allow specific directories:

SKILL_FILE_READ_PATHS=/home/user/documents,/home/user/projects

Restrict file types:

SKILL_FILE_READ_EXTENSIONS=txt,md,json,yaml,yml,js,ts,py

Limit file size:

SKILL_FILE_READ_MAX_SIZE=102400  # 100KB

Risks

Sensitive Data Exposure: Agent might read files containing secrets, passwords, or private information.

Prompt Injection via Files: Malicious content in files could manipulate the agent's behavior.

Best Practices

  1. Limit to specific directories - Never allow root access
  2. Restrict file extensions - Block binary and sensitive file types
  3. Set size limits - Prevent reading huge files
  4. Exclude sensitive files - .env, credentials, private keys
  5. Audit file access - Log which files are read

Sensitive Files to Exclude

# These paths should never be accessible:
# /.env
# /etc/shadow
# /etc/passwd
# ~/.ssh/
# ~/.aws/
# Any file with "secret", "password", "key" in the name

Troubleshooting

File not found

  • Check path is within SKILL_FILE_READ_PATHS
  • Verify file exists: ls -la /path/to/file
  • Check Docker volume mappings

Permission denied

File too large

  • Increase SKILL_FILE_READ_MAX_SIZE
  • Or read file in chunks/sections

Alternatives