You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enable the data-explore agent to correctly read and analyze gitignored CSV files (e.g. data-agent-test/products.csv, users.csv, orders.csv) without hallucinating. The agent runs on a local Ollama model (qwen2.5:7b) and must access private data that is excluded from git.
Files Involved
Agent definition
File
What changed
.opencode/agent/data-explore.md
Simplified from 101 → ~74 lines. Replaced abstract 5-layer grounding framework with direct imperatives. Added Way 1 (@file injection) and Way 2 (Python via bash) modes. Temperature set to 0.1.
.opencode/agent/analyse.md
New agent for general data analysis tasks.
Core source files
File
What changed
packages/opencode/src/tool/read.ts
Added gitignore exemption for data-explore and secret agents at three locations: file read (line ~79), directory listing (line ~119), image/PDF (line ~188). data-explore gets full bypass (real content). secret gets faked content for defense-in-depth. Scout/Sentinel throw.
packages/opencode/src/tool/bash.ts
Added data-explore and secret agent exemptions to all three gitignore check sites: base64 check (~line 200), FILE_READ_CMDS direct args check (~line 230), interpreter inline code check (~line 300). Allows python -c "pd.read_csv(...)" to run without being blocked.
packages/opencode/src/session/prompt.ts
Added data-explore exemption at line ~1264 so @file attachments in the prompt are passed through to ReadTool instead of being blocked. Also added Faker content substitution logic for non-exempt agents.
packages/opencode/src/config/config.ts
Agent loading: name derived from filename without .md extension (e.g. data-explore.md → agent name "data-explore").
packages/opencode/src/config/markdown.ts
FILE_REGEX and files() used by resolvePromptParts() to detect @file patterns in prompts.
bash.ts blocked gitignored files for ALL agents — no agent identity check. When the model ran python3 -c "pd.read_csv('/path/file.csv')", bash.ts extracted the path, checked gitignore, and threw Access denied before executing. The model received the error and hallucinated a plausible result.
read.ts had the exemption at line 79, but a later edit changed it to shouldFake = true for data-explore instead of a full bypass — meaning the model received fake/anonymized data instead of real content.
prompt.ts@file injection path — when using @file syntax in a prompt, resolvePromptParts() creates a FilePart, which flows to createUserMessage() → ReadTool. The data-explore exemption at line 1264 correctly bypasses the gitignore block. However the model still needs to be capable of using tool results rather than hallucinating.
What Was Fixed
Fix
File
Description
Gitignore bypass for bash
bash.ts
Added ctx.agent !== "secret" && ctx.agent !== "data-explore" to all 3 check sites
Full content bypass for read
read.ts
data-explore gets real file content (no faking); secret gets faked content
@file attachment bypass
prompt.ts
data-explore exempted from gitignore block in @file processing path
Prompt simplification
data-explore.md
Reduced complexity so small Ollama models can follow instructions
Remaining Issue
The qwen2.5:7b model (running on remote Ollama at 192.168.31.23:11434) still hallucinates results and claims [EXECUTION_VERIFIED] without actually running code. The code paths are now unblocked — but the model itself doesn't reliably use its tools. It narrates what it would do instead of calling bash or python.
This is a model capability limitation, not a code bug. Possible solutions:
Use a larger model (e.g. qwen2.5:14b or qwen2.5:72b)
Use a model specifically fine-tuned for tool-use/function-calling
Inject file content directly into the prompt (embed CSV text) so the model can analyze it without needing to execute code